Repository: quarkusio/quarkus
Issue: Live reload stopped working on 3.2 when using XA transactions

### Describe the bug

When upgrading from 3.1 to 3.2, using quarkus:dev mode, the application will no longer reload on code changes, but fail with an exception, if an XA transaction manager is used (`quarkus.datasource.jdbc.transactions=xa`). 

### Expected behavior

Application reloads as before

### Actual behavior

```
023-07-06 14:42:10,384 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile [dev]) [Error Occurred After Shutdown]: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
	at io.quarkus.runtime.Application.start(Application.java:101)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:104)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.IllegalStateException: ARJUNA012400: Cannot terminate the recovery manager as the implementation is not known. Could be the recovery manager was not started yet?
	at com.arjuna.ats.arjuna.recovery.RecoveryManager.checkState(RecoveryManager.java:489)
	at com.arjuna.ats.arjuna.recovery.RecoveryManager.getModules(RecoveryManager.java:355)
	at com.arjuna.ats.jbossatx.jta.RecoveryManagerService.addXAResourceRecovery(RecoveryManagerService.java:97)
	at io.quarkus.narayana.jta.runtime.QuarkusRecoveryService.addXAResourceRecovery(QuarkusRecoveryService.java:30)
	at io.agroal.narayana.NarayanaTransactionIntegration.addResourceRecoveryFactory(NarayanaTransactionIntegration.java:132)
	at io.agroal.pool.ConnectionPool.init(ConnectionPool.java:133)
	at io.agroal.pool.DataSource.<init>(DataSource.java:42)
	at io.quarkus.agroal.runtime.DataSources.doCreateDataSource(DataSources.java:246)
	at io.quarkus.agroal.runtime.DataSources$1.apply(DataSources.java:129)
	at io.quarkus.agroal.runtime.DataSources$1.apply(DataSources.java:126)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
	at io.quarkus.agroal.runtime.DataSources.getDataSource(DataSources.java:126)
	at io.quarkus.agroal.runtime.DataSources.fromName(DataSources.java:122)
	at io.quarkus.agroal.runtime.AgroalRecorder.agroalDataSourceSupplier(AgroalRecorder.java:23)
	at io.quarkus.deployment.steps.AgroalProcessor$generateDataSourceBeans109901991.deploy_0(Unknown Source)
	at io.quarkus.deployment.steps.AgroalProcessor$generateDataSourceBeans109901991.deploy(Unknown Source)
	... 11 more
```

### How to Reproduce?

```
modules: agroal, narayana-jta, postgres jdbc driver

quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=postgres
quarkus.datasource.password=postgres
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/postgres
quarkus.datasource.jdbc.transactions=xa
quarkus.transaction-manager.enable-recovery=true

    @Inject
    DataSource ds;

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() throws Exception{
        QuarkusTransaction.requiringNew()
                .run(()->{
                    try(var c = ds.getConnection()) {

                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                });
        return "blah"; // <-- change output to test live reload
    }
```

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

20

### GraalVM version (if different from Java)

20

### Quarkus version or git rev

3.2.0.Final

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

maven

### Additional information

_No response_

Changed files:
extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/QuarkusRecoveryService.java
extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaRecorder.java

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 38b1b1293ae..c73a1cddb39 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
@@ -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;
@@ -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);
         });
diff --git a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/QuarkusRecoveryService.java b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/QuarkusRecoveryService.java
index 55ff7ae05fe..923bcfe4625 100644
--- a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/QuarkusRecoveryService.java
+++ b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/QuarkusRecoveryService.java
@@ -51,4 +51,11 @@ public void create() {
         }
         xaResources.clear();
     }
+
+    @Override
+    public void destroy() {
+        super.destroy();
+        isCreated = false;
+        recoveryManagerService = null;
+    }
 }