throw new IllegalArgumentException(); TransactionImple recovered = new TransactionImple(actId); .baseXid()); _transactions.put(recovered.baseXid(), recovered); recovered.recordTransaction();
public final void recordTransaction() { TransactionImple.putTransaction(this); }
public Set<Xid> getInflightXids(String parentNodeName) { Iterator<TransactionImple> iterator = _transactions.values().iterator(); Set<Xid> toReturn = new HashSet<Xid>(); while (iterator.hasNext()) { TransactionImple next = iterator.next(); if (next.getParentNodeName().equals(parentNodeName)) { toReturn.add(next.baseXid()); } } return toReturn; }
/** * Used to recover an imported transaction. * * @param actId * the state to recover. * @return the recovered transaction object. * @throws javax.transaction.xa.XAException */ public TransactionImple recoverTransaction(Uid actId) throws XAException { if (actId == null) throw new IllegalArgumentException(); TransactionImple recovered = new TransactionImple(actId); if (recovered.baseXid() == null) throw new IllegalArgumentException(); /* * Is the transaction already in the map? This may be the case because * we scan the object store periodically and may get Uids to recover for * transactions that are progressing normally, i.e., do not need * recovery. In which case, we need to ignore them: * * ie calling addImportedTransaction with a non null value for recovered will * call recovered.recordTransaction() */ return (TransactionImple) addImportedTransaction(recovered, recovered.baseXid(), null, 0).getTransaction(); }
synchronized (holder) { recoveredTransaction.recordTransaction(); txn = recoveredTransaction; holder.set(txn); txn = holder.get(); if (txn == null) { txn = new TransactionImple(timeout, xid); holder.set(txn); holder.notifyAll();
@Test public void testTransactionImple () throws Exception { TransactionImple tx = new TransactionImple(new Uid()); TransactionImple dummy = new TransactionImple(new Uid()); tx.recordTransaction(); assertFalse(tx.equals(dummy)); assertTrue(tx.toString() != null); tx.recover(); }
.pop(); indoubt[index] = tx.baseXid(); index++;
public Transaction getTransactionById(Object id) { if (id instanceof Uid) return TransactionImple.getTransaction((Uid) id); return null; }
public SubordinateTransaction createTransaction() { return new TransactionImple(0); // implicit begin }
@Test public void testRecover () throws Exception { ArrayList<String> r = new ArrayList<String>(); TransactionImple tx = new TransactionImple(0); assertTrue(tx.enlistResource(new RecoveryXAResource())); assertEquals(tx.doPrepare(), TwoPhaseOutcome.PREPARE_OK); r.add("com.hp.mwtests.ts.jta.recovery.DummyXARecoveryResource"); jtaPropertyManager.getJTAEnvironmentBean().setXaResourceRecoveryClassNames(r); XARecoveryModule xarm = new XARecoveryModule(); assertNull(xarm.getNewXAResource( new XAResourceRecord(null, null, new XidImple(), null) )); for (int i = 0; i < 11; i++) { xarm.periodicWorkFirstPass(); xarm.periodicWorkSecondPass(); } assertTrue(xarm.getNewXAResource( new XAResourceRecord(null, null, new XidImple(new Uid()), null) ) == null); assertNull(xarm.getNewXAResource( new XAResourceRecord(null, null, new XidImple(), null) )); }
@Override public Object getId() { return get_uid(); }
/** * Used to recover an imported transaction. * * @param actId * the state to recover. * @return the recovered transaction object. * @throws javax.transaction.xa.XAException */ public TransactionImple recoverTransaction(Uid actId) throws XAException { if (actId == null) throw new IllegalArgumentException(); TransactionImple recovered = new TransactionImple(actId); if (recovered.baseXid() == null) throw new IllegalArgumentException(); /* * Is the transaction already in the map? This may be the case because * we scan the object store periodically and may get Uids to recover for * transactions that are progressing normally, i.e., do not need * recovery. In which case, we need to ignore them: * * ie calling addImportedTransaction with a non null value for recovered will * call recovered.recordTransaction() */ return (TransactionImple) addImportedTransaction(recovered, recovered.baseXid(), null, 0).getTransaction(); }
recoveredTransaction.recordTransaction(); txn = recoveredTransaction; } else { txn = new TransactionImple(timeout, xid);
.pop(); indoubt[index] = tx.baseXid(); index++;
public Transaction getTransactionById(Object id) { if (id instanceof Uid) return TransactionImple.getTransaction((Uid) id); return null; }
/** * Create a subordinate transaction associated with the global transaction * inflow and having a specified timeout. * * @param xid * the global transaction. * @param timeout * the timeout associated with the global transaction. * * @return the subordinate transaction. * * @throws javax.transaction.xa.XAException * thrown if there are any errors. */ public SubordinateTransaction importTransaction(Xid xid, int timeout) throws XAException { if (xid == null) throw new IllegalArgumentException(); /* * Check to see if we haven't already imported this thing. */ SubordinateTransaction imported = getImportedTransaction(xid); if (imported == null) { imported = new TransactionImple(timeout, xid); _transactions.put(new XidImple(xid), imported); } return imported; }
@Override public Object getId() { return get_uid(); }
/** * Used to recover an imported transaction. * * @param actId * the state to recover. * @return the recovered transaction object. * @throws javax.transaction.xa.XAException */ public TransactionImple recoverTransaction(Uid actId) throws XAException { if (actId == null) throw new IllegalArgumentException(); TransactionImple recovered = new TransactionImple(actId); if (recovered.baseXid() == null) throw new IllegalArgumentException(); /* * Is the transaction already in the map? This may be the case because * we scan the object store periodically and may get Uids to recover for * transactions that are progressing normally, i.e., do not need * recovery. In which case, we need to ignore them: * * ie calling addImportedTransaction with a non null value for recovered will * call recovered.recordTransaction() */ return (TransactionImple) addImportedTransaction(recovered, recovered.baseXid(), null, 0).getTransaction(); }