public void testXidReturnedOnlyOnce() throws Throwable {
    DummyTransaction dummyTransaction1 = beginAndSuspendTx(this.cache(3));
    prepareTransaction(dummyTransaction1);
    manager(3).stop();
    TestingUtil.blockUntilViewsReceived(60000, false, cache(0), cache(1), cache(2));

    DummyTransaction dummyTransaction = beginAndSuspendTx(this.cache(0));
    Xid[] recover =
        dummyTransaction
            .firstEnlistedResource()
            .recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN);
    assertEquals(recover.length, 1);
    assertEquals(dummyTransaction1.getXid(), recover[0]);
  }
Ejemplo n.º 2
0
 protected void forgetWithInternalId(int cacheIndex) {
   long internalId = -1;
   for (RemoteTransaction rt : tt(1).getRemoteTransactions()) {
     RecoverableTransactionIdentifier a =
         (RecoverableTransactionIdentifier) rt.getGlobalTransaction();
     if (a.getXid().equals(tx.getXid())) {
       internalId = a.getInternalId();
     }
   }
   if (internalId == -1) throw new IllegalStateException();
   log.tracef("About to forget... %s", internalId);
   recoveryOps(cacheIndex).forget(internalId);
   assertEquals(tt(0).getRemoteTxCount(), 0);
   assertEquals(tt(1).getRemoteTxCount(), 0);
 }
Ejemplo n.º 3
0
 private void forgetWithXid(int nodeIndex) {
   Xid xid = tx.getXid();
   recoveryOps(nodeIndex)
       .forget(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier());
   assertEquals(tt(1).getRemoteTxCount(), 0); // make sure tx has been removed
 }
Ejemplo n.º 4
0
 public void testInternalIdOnSameNode() throws Exception {
   Xid xid = tx.getXid();
   recoveryOps(0)
       .forget(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier());
   assertEquals(tt(1).getRemoteTxCount(), 0); // make sure tx has been removed
 }