From af88d23b1be05d84b1cd35324c31dd546e90247b Mon Sep 17 00:00:00 2001 From: Zheng Feng Date: Thu, 23 Nov 2023 20:13:05 +0800 Subject: [PATCH] Add a config property whether to set XATerminator in BootstrapContext --- .../deployment/IronJacamarProcessor.java | 5 +++-- .../pages/includes/quarkus-ironjacamar.adoc | 19 +++++++++++++++++++ .../runtime/IronJacamarBuildtimeConfig.java | 10 ++++++++++ .../runtime/IronJacamarRecorder.java | 6 ++++-- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/deployment/src/main/java/io/quarkiverse/ironjacamar/deployment/IronJacamarProcessor.java b/deployment/src/main/java/io/quarkiverse/ironjacamar/deployment/IronJacamarProcessor.java index a2a3f81..9936af7 100644 --- a/deployment/src/main/java/io/quarkiverse/ironjacamar/deployment/IronJacamarProcessor.java +++ b/deployment/src/main/java/io/quarkiverse/ironjacamar/deployment/IronJacamarProcessor.java @@ -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 diff --git a/docs/modules/ROOT/pages/includes/quarkus-ironjacamar.adoc b/docs/modules/ROOT/pages/includes/quarkus-ironjacamar.adoc index 81cc1d5..0fe75ad 100644 --- a/docs/modules/ROOT/pages/includes/quarkus-ironjacamar.adoc +++ b/docs/modules/ROOT/pages/includes/quarkus-ironjacamar.adoc @@ -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]` diff --git a/runtime/src/main/java/io/quarkiverse/ironjacamar/runtime/IronJacamarBuildtimeConfig.java b/runtime/src/main/java/io/quarkiverse/ironjacamar/runtime/IronJacamarBuildtimeConfig.java index d894d30..a06acf9 100644 --- a/runtime/src/main/java/io/quarkiverse/ironjacamar/runtime/IronJacamarBuildtimeConfig.java +++ b/runtime/src/main/java/io/quarkiverse/ironjacamar/runtime/IronJacamarBuildtimeConfig.java @@ -29,6 +29,16 @@ public interface IronJacamarBuildtimeConfig { @WithDefault("false") boolean metricsEnabled(); + /** + * Where IronJacamar set XATerminator in BootstrapContext. + *

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

+ */ + @WithName("xa-terminator.enabled") + @WithDefault("true") + boolean xaTerminatorEnabled(); + /** * Resource Adapters */ diff --git a/runtime/src/main/java/io/quarkiverse/ironjacamar/runtime/IronJacamarRecorder.java b/runtime/src/main/java/io/quarkiverse/ironjacamar/runtime/IronJacamarRecorder.java index e24a1ed..5927b45 100644 --- a/runtime/src/main/java/io/quarkiverse/ironjacamar/runtime/IronJacamarRecorder.java +++ b/runtime/src/main/java/io/quarkiverse/ironjacamar/runtime/IronJacamarRecorder.java @@ -68,7 +68,7 @@ public Function, 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(); @@ -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);