Skip to content

Commit

Permalink
Merge pull request #35174 from mmusgrov/34576
Browse files Browse the repository at this point in the history
Ensure the narayana-jta extension fully shuts down the recovery manager
  • Loading branch information
gsmet committed Aug 4, 2023
2 parents 0d3cb35 + d99f0b5 commit dcc17a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
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.internal.arjuna.objectstore.jdbc.JDBCStore;
import com.arjuna.ats.jta.common.JTAEnvironmentBean;
import com.arjuna.ats.jta.common.jtaPropertyManager;
Expand Down Expand Up @@ -158,7 +157,14 @@ public void startRecoveryService(final TransactionManagerConfiguration transacti
public void handleShutdown(ShutdownContext context, TransactionManagerConfiguration transactions) {
context.addLastShutdownTask(() -> {
if (transactions.enableRecovery) {
RecoveryManager.manager().terminate(true);
try {
QuarkusRecoveryService.getInstance().stop();
} catch (Exception e) {
// the recovery manager throws IllegalStateException if it has already been shutdown
log.warn("The recovery manager has already been shutdown", e);
} finally {
QuarkusRecoveryService.getInstance().destroy();
}
}
TransactionReaper.terminate(false);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,11 @@ public void create() {
}
xaResources.clear();
}

@Override
public void destroy() {
super.destroy();
isCreated = false;
recoveryManagerService = null;
}
}

0 comments on commit dcc17a6

Please sign in to comment.