This commit is contained in:
Clebert Suconic 2019-11-22 17:04:34 -05:00
commit c2c0890178
4 changed files with 15 additions and 0 deletions

View File

@ -392,12 +392,18 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
Transaction txToRollback = tx; Transaction txToRollback = tx;
if (txToRollback != null) { if (txToRollback != null) {
if (txToRollback.getXid() != null) {
resourceManager.removeTransaction(txToRollback.getXid());
}
txToRollback.rollbackIfPossible(); txToRollback.rollbackIfPossible();
} }
txToRollback = pendingTX; txToRollback = pendingTX;
if (txToRollback != null) { if (txToRollback != null) {
if (txToRollback.getXid() != null) {
resourceManager.removeTransaction(txToRollback.getXid());
}
txToRollback.rollbackIfPossible(); txToRollback.rollbackIfPossible();
} }

View File

@ -46,4 +46,6 @@ public interface ResourceManager extends ActiveMQComponent {
List<Xid> getInDoubtTransactions(); List<Xid> getInDoubtTransactions();
int size();
} }

View File

@ -61,6 +61,11 @@ public class ResourceManagerImpl implements ResourceManager {
// ActiveMQComponent implementation // ActiveMQComponent implementation
@Override
public int size() {
return transactions.size();
}
@Override @Override
public void start() throws Exception { public void start() throws Exception {
if (started) { if (started) {

View File

@ -167,6 +167,8 @@ public class SessionFailureXATest extends ActiveMQTestBase {
Wait.assertEquals(0, () -> messagingService.getSessions().size()); Wait.assertEquals(0, () -> messagingService.getSessions().size());
Wait.assertEquals(0, messagingService.getResourceManager()::size);
locator = createInVMNonHALocator(); locator = createInVMNonHALocator();
sessionFactory = createSessionFactory(locator); sessionFactory = createSessionFactory(locator);
clientSession = addClientSession(sessionFactory.createSession(true, false, false)); clientSession = addClientSession(sessionFactory.createSession(true, false, false));