Skip to content

Commit

Permalink
Add a config property whether to set XATerminator in BootstrapContext
Browse files Browse the repository at this point in the history
  • Loading branch information
zhfeng committed Nov 23, 2023
1 parent 4ec2d6b commit af88d23
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,10 @@ void registerSyntheticBeans(

@BuildStep
@Record(value = ExecutionTime.STATIC_INIT)
void initDefaultBootstrapContext(BeanContainerBuildItem beanContainerBuildItem, IronJacamarRecorder recorder) {
void initDefaultBootstrapContext(BeanContainerBuildItem beanContainerBuildItem, IronJacamarRecorder recorder,
IronJacamarBuildtimeConfig config) {
// Create the default bootstrap context
recorder.initDefaultBootstrapContext(beanContainerBuildItem.getValue());
recorder.initDefaultBootstrapContext(beanContainerBuildItem.getValue(), config.xaTerminatorEnabled());
}

@BuildStep
Expand Down
19 changes: 19 additions & 0 deletions docs/modules/ROOT/pages/includes/quarkus-ironjacamar.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,25 @@ endif::add-copy-button-to-env-var[]
|`false`


a|icon:lock[title=Fixed at build time] [[quarkus-ironjacamar_quarkus.ironjacamar.xa-terminator.enabled]]`link:#quarkus-ironjacamar_quarkus.ironjacamar.xa-terminator.enabled[quarkus.ironjacamar.xa-terminator.enabled]`


[.description]
--
Where IronJacamar set XATerminator in BootstrapContext.

This is a global setting and is not specific to a resource adapter.

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_IRONJACAMAR_XA_TERMINATOR_ENABLED+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_IRONJACAMAR_XA_TERMINATOR_ENABLED+++`
endif::add-copy-button-to-env-var[]
--|boolean
|`true`


a|icon:lock[title=Fixed at build time] [[quarkus-ironjacamar_quarkus.ironjacamar.ra.kind]]`link:#quarkus-ironjacamar_quarkus.ironjacamar.ra.kind[quarkus.ironjacamar.ra.kind]`

`link:#quarkus-ironjacamar_quarkus.ironjacamar.ra.kind[quarkus.ironjacamar."resource-adapter-name".ra.kind]`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ public interface IronJacamarBuildtimeConfig {
@WithDefault("false")
boolean metricsEnabled();

/**
* Where IronJacamar set XATerminator in BootstrapContext.
* <p>
* This is a global setting and is not specific to a resource adapter.
* <p>
*/
@WithName("xa-terminator.enabled")
@WithDefault("true")
boolean xaTerminatorEnabled();

/**
* Resource Adapters
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public Function<SyntheticCreationalContext<QuarkusSecurityIntegration>, QuarkusS
return context -> new QuarkusSecurityIntegration();
}

public void initDefaultBootstrapContext(BeanContainer beanContainer) {
public void initDefaultBootstrapContext(BeanContainer beanContainer, boolean xaTerminatorEnabled) {
TransactionIntegration transactionIntegration = beanContainer.beanInstance(TransactionIntegration.class);
SecurityIntegration securityIntegration = beanContainer.beanInstance(QuarkusSecurityIntegration.class);
BaseCloneableBootstrapContext bootstrapContext = new BaseCloneableBootstrapContext();
Expand All @@ -88,7 +88,9 @@ public void initDefaultBootstrapContext(BeanContainer beanContainer) {
bootstrapContext.setWorkManager(workManager);
bootstrapContext.setWorkManagerName(DEFAULT_WORK_MANAGER_NAME);
bootstrapContext.setTransactionSynchronizationRegistry(transactionIntegration.getTransactionSynchronizationRegistry());
bootstrapContext.setXATerminator(transactionIntegration.getXATerminator());
if (xaTerminatorEnabled) {
bootstrapContext.setXATerminator(transactionIntegration.getXATerminator());
}

// Register the default in the coordinator
WorkManagerCoordinator.getInstance().setDefaultWorkManager(workManager);
Expand Down

0 comments on commit af88d23

Please sign in to comment.