This closes #2900
This commit is contained in:
commit
c2c0890178
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,4 +46,6 @@ public interface ResourceManager extends ActiveMQComponent {
|
||||||
|
|
||||||
List<Xid> getInDoubtTransactions();
|
List<Xid> getInDoubtTransactions();
|
||||||
|
|
||||||
|
int size();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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));
|
||||||
|
|
Loading…
Reference in New Issue