From 162b4c582edb2f73073c217dcc0bd701a2d28e75 Mon Sep 17 00:00:00 2001 From: Zheng Feng Date: Wed, 15 Jun 2022 08:58:13 +0800 Subject: [PATCH] Add start and stop Recovery Manager --- .../quarkus/narayana/jta/runtime/NarayanaJtaProducers.java | 6 +++++- .../quarkus/narayana/jta/runtime/NarayanaJtaRecorder.java | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaProducers.java b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaProducers.java index 85e4b99d2e17e2..041fbeb4466e95 100644 --- a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaProducers.java +++ b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaProducers.java @@ -33,8 +33,12 @@ public javax.transaction.UserTransaction userTransaction() { @Produces @ApplicationScoped + @Unremovable public XAResourceRecoveryRegistry xaResourceRecoveryRegistry() { - return new RecoveryManagerService(); + RecoveryManagerService recoveryManagerService = new RecoveryManagerService(); + recoveryManagerService.create(); + recoveryManagerService.start(); + return recoveryManagerService; } @Produces diff --git a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaRecorder.java b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaRecorder.java index b66dd67487d377..7caf66cac74b8a 100644 --- a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaRecorder.java +++ b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaRecorder.java @@ -10,6 +10,7 @@ import com.arjuna.ats.arjuna.common.arjPropertyManager; import com.arjuna.ats.arjuna.coordinator.TransactionReaper; import com.arjuna.ats.arjuna.coordinator.TxControl; +import com.arjuna.ats.arjuna.recovery.RecoveryManager; import com.arjuna.ats.jta.common.jtaPropertyManager; import com.arjuna.common.util.propertyservice.PropertiesFactory; @@ -74,6 +75,7 @@ public void handleShutdown(ShutdownContext context) { context.addLastShutdownTask(new Runnable() { @Override public void run() { + RecoveryManager.manager().terminate(true); TransactionReaper.terminate(false); } });