Search in sources :

Example 1 with ActivityHandleImple

use of com.arjuna.mwlabs.wsas.activity.ActivityHandleImple in project narayana by jbosstm.

the class UserActivityImple method resume.

/**
 * Given a token representing a context, associate it with the current
 * thread of control. This will implicitly disassociate the thread from any
 * activities that it may already be associated with. If the parameter is
 * null then the thread is associated with no activity.
 *
 * @param tx The activity to associate with this thread. This
 * may be null in which case the current thread becomes associated with
 * no activity.
 *
 * @exception InvalidActivityException Thrown if the activity handle
 * is invalid in this context.
 * @exception SystemException Thrown if any other error occurs.
 */
public void resume(ActivityHierarchy tx) throws InvalidActivityException, SystemException {
    if (tx == null) {
        purge();
    } else {
        if (tx instanceof ActivityHierarchyImple) {
            try {
                for (int i = 0; i < tx.size(); i++) {
                    ActivityHandleImple handle = (ActivityHandleImple) tx.activity(i);
                    push(handle.getActivity());
                }
            } catch (Exception ex) {
                ex.printStackTrace();
                purge();
            }
        } else
            throw new InvalidActivityException(wsasLogger.i18NLogger.get_UserActivityImple_51());
    }
    ActivityImple currentActivity = current();
    String serviceType = currentActivity.serviceType();
    HLS hls = HLSManager.getHighLevelService(serviceType);
    if (hls != null) {
        try {
            hls.resumed();
        } catch (SystemException ex) {
            wsasLogger.i18NLogger.warn_UserActivityImple_5(ex);
        }
    }
}
Also used : InvalidActivityException(com.arjuna.mw.wsas.exceptions.InvalidActivityException) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) ActivityImple(com.arjuna.mwlabs.wsas.activity.ActivityImple) ActivityHierarchyImple(com.arjuna.mwlabs.wsas.activity.ActivityHierarchyImple) ActivityHandleImple(com.arjuna.mwlabs.wsas.activity.ActivityHandleImple) EmptyStackException(java.util.EmptyStackException) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) InvalidTimeoutException(com.arjuna.mw.wsas.exceptions.InvalidTimeoutException) ActiveChildException(com.arjuna.mw.wsas.exceptions.ActiveChildException) NoPermissionException(com.arjuna.mw.wsas.exceptions.NoPermissionException) NoActivityException(com.arjuna.mw.wsas.exceptions.NoActivityException) WrongStateException(com.arjuna.mw.wsas.exceptions.WrongStateException) InvalidActivityException(com.arjuna.mw.wsas.exceptions.InvalidActivityException) ProtocolViolationException(com.arjuna.mw.wsas.exceptions.ProtocolViolationException) HLS(com.arjuna.mw.wsas.activity.HLS)

Example 2 with ActivityHandleImple

use of com.arjuna.mwlabs.wsas.activity.ActivityHandleImple in project narayana by jbosstm.

the class CoordinatorControl method parentCoordinator.

private final BACoordinator parentCoordinator() throws SystemException {
    try {
        ActivityHierarchy hier = UserActivityFactory.userActivity().currentActivity();
        ActivityHandleImple parentActivity = null;
        BACoordinator parentCoordinator = null;
        if (hier.size() > 1) {
            parentActivity = (ActivityHandleImple) hier.activity(hier.size() - 2);
            parentCoordinator = (BACoordinator) _coordinators.get(parentActivity);
        }
        return parentCoordinator;
    } catch (Exception ex) {
        ex.printStackTrace();
        return null;
    }
}
Also used : ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) ActivityHandleImple(com.arjuna.mwlabs.wsas.activity.ActivityHandleImple) SubordinateBACoordinator(com.arjuna.mwlabs.wscf.model.sagas.arjunacore.subordinate.SubordinateBACoordinator) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) NoActivityException(com.arjuna.mw.wsas.exceptions.NoActivityException) WrongStateException(com.arjuna.mw.wsas.exceptions.WrongStateException) ProtocolViolationException(com.arjuna.mw.wsas.exceptions.ProtocolViolationException)

Example 3 with ActivityHandleImple

use of com.arjuna.mwlabs.wsas.activity.ActivityHandleImple in project narayana by jbosstm.

the class CoordinatorControl method parentCoordinator.

private final ATCoordinator parentCoordinator() throws SystemException {
    try {
        ActivityHierarchy hier = UserActivityFactory.userActivity().currentActivity();
        ActivityHandleImple parentActivity = null;
        ATCoordinator parentCoordinator = null;
        if (hier.size() > 1) {
            parentActivity = (ActivityHandleImple) hier.activity(hier.size() - 2);
            parentCoordinator = (ATCoordinator) _coordinators.get(parentActivity);
        }
        return parentCoordinator;
    } catch (Exception ex) {
        ex.printStackTrace();
        return null;
    }
}
Also used : SubordinateATCoordinator(com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateATCoordinator) ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) ActivityHandleImple(com.arjuna.mwlabs.wsas.activity.ActivityHandleImple) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) NoActivityException(com.arjuna.mw.wsas.exceptions.NoActivityException) WrongStateException(com.arjuna.mw.wsas.exceptions.WrongStateException) ProtocolViolationException(com.arjuna.mw.wsas.exceptions.ProtocolViolationException)

Aggregations

NoActivityException (com.arjuna.mw.wsas.exceptions.NoActivityException)3 ProtocolViolationException (com.arjuna.mw.wsas.exceptions.ProtocolViolationException)3 SystemException (com.arjuna.mw.wsas.exceptions.SystemException)3 WrongStateException (com.arjuna.mw.wsas.exceptions.WrongStateException)3 ActivityHandleImple (com.arjuna.mwlabs.wsas.activity.ActivityHandleImple)3 ActivityHierarchy (com.arjuna.mw.wsas.activity.ActivityHierarchy)2 HLS (com.arjuna.mw.wsas.activity.HLS)1 ActiveChildException (com.arjuna.mw.wsas.exceptions.ActiveChildException)1 InvalidActivityException (com.arjuna.mw.wsas.exceptions.InvalidActivityException)1 InvalidTimeoutException (com.arjuna.mw.wsas.exceptions.InvalidTimeoutException)1 NoPermissionException (com.arjuna.mw.wsas.exceptions.NoPermissionException)1 ActivityHierarchyImple (com.arjuna.mwlabs.wsas.activity.ActivityHierarchyImple)1 ActivityImple (com.arjuna.mwlabs.wsas.activity.ActivityImple)1 SubordinateBACoordinator (com.arjuna.mwlabs.wscf.model.sagas.arjunacore.subordinate.SubordinateBACoordinator)1 SubordinateATCoordinator (com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateATCoordinator)1 EmptyStackException (java.util.EmptyStackException)1