Search in sources :

Example 21 with BasicAction

use of com.arjuna.ats.arjuna.coordinator.BasicAction in project narayana by jbosstm.

the class ArjunaTransactionImple method is_descendant_transaction.

/**
 * Is this transaction a descendant of tc?
 */
public boolean is_descendant_transaction(Coordinator tc) throws SystemException {
    if (tc == null)
        return false;
    try {
        UidCoordinator ptr = com.arjuna.ArjunaOTS.UidCoordinatorHelper.narrow(tc);
        if (ptr != null) {
            /*
				 * Must be an Arjuna coordinator.
				 */
            Uid lookingFor = new Uid(ptr.uid());
            BasicAction lookingAt = this;
            if (jtsLogger.logger.isTraceEnabled()) {
                jtsLogger.logger.trace("ArjunaTransactionImple::is_descendant_transaction - looking for " + lookingFor);
            }
            while (lookingAt != null) {
                if (jtsLogger.logger.isTraceEnabled()) {
                    jtsLogger.logger.trace("ArjunaTransactionImple::is_descendant_transaction - looking for " + lookingAt.get_uid());
                }
                if (lookingAt.get_uid().equals(lookingFor))
                    return true;
                else
                    lookingAt = lookingAt.parent();
            }
            ptr = null;
        } else
            throw new BAD_PARAM();
    } catch (SystemException e) {
    /*
			 * Narrow failed, so can't be an Arjuna Uid. Therefore, the answer
			 * must be false.
			 */
    }
    return false;
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) UidCoordinator(com.arjuna.ArjunaOTS.UidCoordinator) BasicAction(com.arjuna.ats.arjuna.coordinator.BasicAction) SystemException(org.omg.CORBA.SystemException) BAD_PARAM(org.omg.CORBA.BAD_PARAM)

Example 22 with BasicAction

use of com.arjuna.ats.arjuna.coordinator.BasicAction in project narayana by jbosstm.

the class Helper method localAction.

/**
 * Given a Control_ptr determine if this is a reference to a local
 * action, and if so return the raw BasicAction pointer.
 */
public static final BasicAction localAction(org.omg.CosTransactions.Control control) {
    if (control == null)
        return null;
    if (control instanceof ControlImple) {
        try {
            ControlImple c = (ControlImple) control;
            return (BasicAction) c.getImplHandle();
        } catch (Exception e) {
        }
    }
    try {
        UidCoordinator coord = Helper.getUidCoordinator(control);
        if (coord != null) {
            Uid u = Helper.getUid(coord);
            coord = null;
            return ActionManager.manager().get(u);
        } else
            throw new BAD_PARAM();
    } catch (Exception e) {
    /*
	     * Can't be an Arjuna action, so ignore.
	     */
    }
    return null;
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) UidCoordinator(com.arjuna.ArjunaOTS.UidCoordinator) BasicAction(com.arjuna.ats.arjuna.coordinator.BasicAction) BAD_PARAM(org.omg.CORBA.BAD_PARAM) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple)

Aggregations

BasicAction (com.arjuna.ats.arjuna.coordinator.BasicAction)22 Uid (com.arjuna.ats.arjuna.common.Uid)8 BAD_PARAM (org.omg.CORBA.BAD_PARAM)4 UidCoordinator (com.arjuna.ArjunaOTS.UidCoordinator)3 AtomicAction (com.arjuna.ats.arjuna.AtomicAction)3 AbstractRecord (com.arjuna.ats.arjuna.coordinator.AbstractRecord)3 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)3 ObjectStoreException (com.arjuna.ats.arjuna.exceptions.ObjectStoreException)2 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)2 CadaverActivationRecord (com.arjuna.ats.internal.arjuna.abstractrecords.CadaverActivationRecord)2 CadaverLockRecord (com.arjuna.ats.internal.txoj.abstractrecords.CadaverLockRecord)2 Enumeration (java.util.Enumeration)2 SystemException (org.omg.CORBA.SystemException)2 Inactive (org.omg.CosTransactions.Inactive)2 RecoveryCoordinator (org.omg.CosTransactions.RecoveryCoordinator)2 OTSAbstractRecord (com.arjuna.ArjunaOTS.OTSAbstractRecord)1 ActionHierarchy (com.arjuna.ats.arjuna.coordinator.ActionHierarchy)1 RecoveryStore (com.arjuna.ats.arjuna.objectstore.RecoveryStore)1 ActivationRecord (com.arjuna.ats.internal.arjuna.abstractrecords.ActivationRecord)1 CadaverRecord (com.arjuna.ats.internal.arjuna.abstractrecords.CadaverRecord)1