Search in sources :

Example 1 with InvalidTimeoutException

use of com.arjuna.mw.wsas.exceptions.InvalidTimeoutException in project narayana by jbosstm.

the class UserActivityImple method start.

/**
 * Start a new activity. If there is already an activity associated
 * with the thread then it will be nested.
 *
 * @param serviceType specifies the type of coordinator which will be
 * instantiated to manage the activity.
 * @param timeout The timeout associated with the activity. If the
 * activity has not been terminated by the time this period elapses, then
 * it will automatically be terminated.
 * @exception WrongStateException Thrown if the currently associated
 * activity is in a state that does not allow a new activity to be
 * enlisted as a child.
 * @exception InvalidTimeoutException Thrown if the specified timeout is
 * invalid within the current working environment.
 * @exception SystemException Thrown in any other situation.
 */
public void start(String serviceType, int timeout) throws WrongStateException, InvalidTimeoutException, SystemException {
    if (timeout < 0)
        throw new InvalidTimeoutException();
    else {
        if (timeout == 0)
            timeout = getTimeout();
    }
    ActivityImple currentActivity = new ActivityImple(current(), serviceType);
    currentActivity.start(timeout);
    push(currentActivity);
    HLS hls = HLSManager.getHighLevelService(serviceType);
    try {
        if (hls != null) {
            hls.begun();
        }
    } catch (SystemException ex) {
        try {
            setCompletionStatus(FailureOnly.instance());
        } catch (Exception e) {
            wsasLogger.i18NLogger.warn_UserActivityImple_1(e);
        }
        throw ex;
    }
}
Also used : InvalidTimeoutException(com.arjuna.mw.wsas.exceptions.InvalidTimeoutException) SystemException(com.arjuna.mw.wsas.exceptions.SystemException) ActivityImple(com.arjuna.mwlabs.wsas.activity.ActivityImple) HLS(com.arjuna.mw.wsas.activity.HLS) 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)

Aggregations

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 NoActivityException (com.arjuna.mw.wsas.exceptions.NoActivityException)1 NoPermissionException (com.arjuna.mw.wsas.exceptions.NoPermissionException)1 ProtocolViolationException (com.arjuna.mw.wsas.exceptions.ProtocolViolationException)1 SystemException (com.arjuna.mw.wsas.exceptions.SystemException)1 WrongStateException (com.arjuna.mw.wsas.exceptions.WrongStateException)1 ActivityImple (com.arjuna.mwlabs.wsas.activity.ActivityImple)1 EmptyStackException (java.util.EmptyStackException)1