ARTEMIS-2559 Clear Transaction out of ResourceManager in case of failure
This commit is contained in:
parent
6c33a48c15
commit
506c03a884
|
@ -392,12 +392,18 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
|
||||
Transaction txToRollback = tx;
|
||||
if (txToRollback != null) {
|
||||
if (txToRollback.getXid() != null) {
|
||||
resourceManager.removeTransaction(txToRollback.getXid());
|
||||
}
|
||||
txToRollback.rollbackIfPossible();
|
||||
}
|
||||
|
||||
txToRollback = pendingTX;
|
||||
|
||||
if (txToRollback != null) {
|
||||
if (txToRollback.getXid() != null) {
|
||||
resourceManager.removeTransaction(txToRollback.getXid());
|
||||
}
|
||||
txToRollback.rollbackIfPossible();
|
||||
}
|
||||
|
||||
|
|
|
@ -46,4 +46,6 @@ public interface ResourceManager extends ActiveMQComponent {
|
|||
|
||||
List<Xid> getInDoubtTransactions();
|
||||
|
||||
int size();
|
||||
|
||||
}
|
||||
|
|
|
@ -61,6 +61,11 @@ public class ResourceManagerImpl implements ResourceManager {
|
|||
|
||||
// ActiveMQComponent implementation
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return transactions.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws Exception {
|
||||
if (started) {
|
||||
|
|
|
@ -167,6 +167,8 @@ public class SessionFailureXATest extends ActiveMQTestBase {
|
|||
|
||||
Wait.assertEquals(0, () -> messagingService.getSessions().size());
|
||||
|
||||
Wait.assertEquals(0, messagingService.getResourceManager()::size);
|
||||
|
||||
locator = createInVMNonHALocator();
|
||||
sessionFactory = createSessionFactory(locator);
|
||||
clientSession = addClientSession(sessionFactory.createSession(true, false, false));
|
||||
|
|
Loading…
Reference in New Issue