@Override protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<Void> handbackHolder) throws OperationFailedException { int maximum_timeout = resolvedValue.asInt(); if (TxControl.getDefaultTimeout() == 0) { TransactionLogger.ROOT_LOGGER.timeoutValueIsSetToMaximum(maximum_timeout); ContextTransactionManager.setGlobalDefaultTransactionTimeout(maximum_timeout); } return false; }
@Override protected void revertUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode valueToRestore, final ModelNode valueToRevert, final Void handback) throws OperationFailedException { TxControl.setDefaultTimeout(valueToRestore.asInt()); ContextTransactionManager.setGlobalDefaultTransactionTimeout(valueToRestore.asInt()); } }
private XidImple convertXid(Xid xid) { if (xid != null && xid.getFormatId() == XATxConverter.FORMAT_ID) { XidImple toImport = new XidImple(xid); XATxConverter.setSubordinateNodeName(toImport.getXID(), TxControl.getXANodeName()); return new SubordinateXidImple(toImport); } else { return new XidImple(xid); } }
public SubordinateAtomicAction (int timeout, Xid xid) { super(timeout); // implicit start (done in base class) if (xid != null && xid.getFormatId() == XATxConverter.FORMAT_ID) { XidImple toImport = new XidImple(xid); XID toCheck = toImport.getXID(); _parentNodeName = XATxConverter.getSubordinateNodeName(toCheck); if (_parentNodeName == null) { _parentNodeName = XATxConverter.getNodeName(toCheck); } XATxConverter.setSubordinateNodeName(toImport.getXID(), TxControl.getXANodeName()); _theXid = new XidImple(toImport); } else { _theXid = new XidImple(xid); } _activated = true; }
if (uid.notEquals(Uid.nullUid())) XidImple loadedXid = (XidImple) saa.getXid(); if (loadedXid.getFormatId() == XATxConverter.FORMAT_ID) { String loadedXidSubordinateNodeName = XATxConverter.getSubordinateNodeName(loadedXid.getXID()); if (TxControl.getXANodeName().equals(loadedXidSubordinateNodeName)) { if (parentNodeName.equals(saa.getParentNodeName())) { if (jtaLogger.logger.isDebugEnabled()) { XidImple loadedXid = (XidImple) saa.getXid(); if (loadedXid.getFormatId() == XATxConverter.FORMAT_ID) { String loadedXidSubordinateNodeName = XATxConverter.getSubordinateNodeName(loadedXid.getXID()); if (XATxConverter.getSubordinateNodeName(new XidImple(xid).getXID()).equals(loadedXidSubordinateNodeName)) { if (Arrays.equals(loadedXid.getGlobalTransactionId(), xid.getGlobalTransactionId())) { if (jtaLogger.logger.isDebugEnabled()) { jtaLogger.logger.debug("Found record for " + saa);
byte[] gtridUid = uid.getBytes(); String nodeName = TxControl.getXANodeName(); int nodeNameLengthToUse = nodeName.getBytes().length; xid.gtrid_length = gtridUid.length+nodeNameLengthToUse; if (branch.notEquals(Uid.nullUid())) setEisName(xid, eisName);
+ get_uid()); if (!TxControl.isEnabled()) { tsLogger.i18NLogger.warn_coordinator_BasicAction_29(get_uid(), ActionStatus.stringForm(actionStatus)); actionInitialise(parentAct); actionStatus = ActionStatus.RUNNING;
public int end (boolean report_heuristics) { int outcome; if (parent() != null) parent().removeChildAction(this); boolean canEnd = true; if(status() != ActionStatus.ABORT_ONLY || TxControl.isBeforeCompletionWhenRollbackOnly()) { canEnd = beforeCompletion(); } if (canEnd) { outcome = super.End(report_heuristics); } else outcome = super.Abort(); afterCompletion(outcome); return outcome; }
this.nodeIdentifier = TxControl.getXANodeName(); this.eisNameStore = StoreManager.getEISNameStore(); InputObjectState states = new InputObjectState(); while (states.notempty()) { Uid uid = UidHelper.unpackFrom(states); if (uid.equals(Uid.nullUid())) { break; } else {
/** * Start the transaction running. * * If the transaction is already running or has terminated, then an error * code will be returned. * * @param timeout the timeout associated with the transaction. If the * transaction is still active when this timeout elapses, the * system will automatically roll it back. * * @return <code>ActionStatus</code> indicating outcome. */ public int begin (int timeout) { int status = super.start(); if (status == ActionStatus.RUNNING) { /* * Now do thread/action tracking. */ ThreadActionData.pushAction(this); _timeout = timeout; if (_timeout == 0) _timeout = TxControl.getDefaultTimeout(); if (_timeout > 0) TransactionReaper.transactionReaper().insert(this, _timeout); } return status; }
if(TxControl.isBeforeCompletionWhenRollbackOnly()) throw new INVALID_TRANSACTION(0, CompletionStatus.COMPLETED_NO); // means case ActionStatus.H_MIXED: case ActionStatus.H_HAZARD: throw new INVALID_TRANSACTION(0, CompletionStatus.COMPLETED_NO); // means
@Test public void testSubordinateJTAXAResourceOrphanFilter() throws HeuristicRollbackException, HeuristicMixedException, HeuristicCommitException, SystemException, RollbackException, XAException { XAResourceOrphanFilter orphanFilter = new SubordinateJTAXAResourceOrphanFilter(); XidImple xid = (XidImple) XATxConverter.getXid(Uid.nullUid(), false, XATxConverter.FORMAT_ID); XATxConverter.setSubordinateNodeName(xid.getXID(), TxControl.getXANodeName()); List<String> xaRecoveryNodes = jtaPropertyManager.getJTAEnvironmentBean().getXaRecoveryNodes(); try { jtaPropertyManager.getJTAEnvironmentBean().setXaRecoveryNodes(Arrays.asList("2")); assertEquals(XAResourceOrphanFilter.Vote.ABSTAIN, orphanFilter.checkXid(xid)); jtaPropertyManager.getJTAEnvironmentBean().setXaRecoveryNodes(Arrays.asList("1")); assertEquals(XAResourceOrphanFilter.Vote.ROLLBACK, orphanFilter.checkXid(xid)); } finally { jtaPropertyManager.getJTAEnvironmentBean().setXaRecoveryNodes(xaRecoveryNodes); } } }
public RecoveryXAResource () { if (xids == null) { xids = new Xid[2]; AtomicAction a = new AtomicAction(); xids[0] = new XidImple(a); String c = com.arjuna.ats.arjuna.coordinator.TxControl.getXANodeName(); String b = "2"; com.arjuna.ats.arjuna.coordinator.TxControl.setXANodeName(b); xids[1] = new XidImple(new Uid()); com.arjuna.ats.arjuna.coordinator.TxControl.setXANodeName(c); } }
public static class Shutdown extends Thread { public void run() { // guard against simultaneous user-initiated shutdown // synchronize on the class since the shutdown method on TxControl is static synchronized synchronized (TxControl.class) { // check that this hook is still active if (_shutdownHook == this && transactionStatusManager != null) { transactionStatusManager.shutdown(); transactionStatusManager = null; } } } };
XidImple xid2 = new XidImple(new Uid()); assertTrue(XATxConverter.getNodeName(xid1.getXID()).equals(TxControl.getXANodeName()));
@Test public void test() { DummyXA xa = new DummyXA(false); assertFalse(XAUtils.mustEndSuspendedRMs(xa)); assertTrue(XAUtils.canOptimizeDelist(xa)); assertEquals(XAUtils.getXANodeName(new XidImple(new Uid())), TxControl.getXANodeName()); }
/** * Stop the transaction system. New transactions will be prevented but * recovery will be allowed to continue. */ public static final synchronized void disable() { disable(false); }
/** * Start the transaction system. This allows new transactions to be created * and for recovery to execute. */ public static final synchronized void enable() { createTransactionStatusManager(); TxControl.enable = true; }
if (TxControl.isReadonlyOptimisation())
private XidImple convertXid(Xid xid) { if (xid != null && xid.getFormatId() == XATxConverter.FORMAT_ID) { XidImple toImport = new XidImple(xid); XATxConverter.setSubordinateNodeName(toImport.getXID(), TxControl.getXANodeName()); return new SubordinateXidImple(toImport); } else { return new XidImple(xid); } }