use of com.arjuna.mw.wsas.exceptions.InvalidActivityException in project narayana by jbosstm.
the class BAParticipantManagerImple method fail.
public void fail(final QName exceptionIdentifier) throws SystemException {
if (wstxLogger.logger.isTraceEnabled()) {
wstxLogger.logger.trace(getClass().getSimpleName() + ".fail. Participant id: " + _participantId + ", exceptionIdentifier: " + exceptionIdentifier);
}
try {
if (_hier == null)
throw new UnknownTransactionException();
_coordManager.resume(_hier);
// fail means faulted as far as the coordinator manager is concerned
_coordManager.participantFaulted(_participantId);
_coordManager.suspend();
} catch (final InvalidActivityException iae) {
throw new SystemException("UnknownTransactionException");
} catch (final UnknownTransactionException ute) {
throw new SystemException("UnknownTransactionException");
} catch (com.arjuna.mw.wscf.exceptions.InvalidParticipantException ex) {
throw new SystemException("UnknownParticipantException");
} catch (com.arjuna.mw.wsas.exceptions.NoActivityException ex) {
throw new SystemException("UnknownTransactionException");
} catch (com.arjuna.mw.wsas.exceptions.SystemException ex) {
throw new SystemException(ex.toString());
}
}
use of com.arjuna.mw.wsas.exceptions.InvalidActivityException in project narayana by jbosstm.
the class UserActivityImple method end.
/**
* Complete the activity with the completion status provided.
*
* @param cs The CompletionStatus to use.
*
* @exception InvalidActivityException Thrown if the current activity is
* invalid in the execution environment.
* @exception ActiveChildException Thrown if the current activity is a
* @exception WrongStateException Thrown if the current activity is not in a
* state that allows it to be completed, or is incompatible with the
* completion status provided.
* @exception ProtocolViolationException Thrown if the a violation of the
* activity service or HLS protocol occurs.
* @exception NoActivityException Thrown if there is no activity
* associated with the invoking thread or none with the given type of coordinator.
* @exception NoPermissionException Thrown if the invoking thread does
* not have permission to terminate the transaction.
* @exception SystemException Thrown if some other error occurred.
*
* @return the result of completing the activity. Null is valid and must
* be interpreted within the context of any HLS that may exist.
*
* @see com.arjuna.mw.wsas.Outcome
*/
public Outcome end(CompletionStatus cs) throws InvalidActivityException, WrongStateException, ProtocolViolationException, SystemException, NoActivityException, NoPermissionException, ActiveChildException {
ActivityImple currentActivity = current();
if (currentActivity == null) {
throw new NoActivityException();
}
/*
if (currentActivity.parent() != null)
throw new ActiveChildException();
*/
Outcome res = null;
String serviceType = currentActivity.serviceType();
try {
res = currentActivity.end(cs);
} catch (Exception ex) {
wsasLogger.i18NLogger.warn_UserActivityImple_2(ex);
}
HLS hls = HLSManager.getHighLevelService(serviceType);
if (hls != null) {
try {
hls.completed();
} catch (SystemException ex) {
wsasLogger.i18NLogger.warn_UserActivityImple_3(ex);
}
}
pop();
return res;
}
use of com.arjuna.mw.wsas.exceptions.InvalidActivityException in project narayana by jbosstm.
the class UserActivityImple method end.
/**
* Complete the activity with the completion status provided.
*
* @exception InvalidActivityException Thrown if the current activity is
* invalid in the execution environment.
* @exception ActiveChildException Thrown if the current activity is a
* @exception WrongStateException Thrown if the current activity is not in a
* state that allows it to be completed, or is incompatible with the
* completion status provided.
* @exception ProtocolViolationException Thrown if the a violation of the
* activity service or HLS protocol occurs.
* @exception NoActivityException Thrown if there is no activity
* associated with the invoking thread or none with the given type of coordinator.
* @exception NoPermissionException Thrown if the invoking thread does
* not have permission to terminate the transaction.
* @exception SystemException Thrown if some other error occurred.
*
* @return the result of completing the activity. Null is valid and must
* be interpreted within the context of any HLS that may exist.
*
* @see com.arjuna.mw.wsas.activity.Outcome
* @message com.arjuna.mwlabs.wsas.UserActivityImple_2 [com.arjuna.mwlabs.wsas.UserActivityImple_2] - currentActivity.end threw:
* @message com.arjuna.mwlabs.wsas.UserActivityImple_3 [com.arjuna.mwlabs.wsas.UserActivityImple_3] - Activity.completed caught:
*/
public Outcome end() throws InvalidActivityException, WrongStateException, ProtocolViolationException, SystemException, NoActivityException, SystemException, NoPermissionException, ActiveChildException {
ActivityImple currentActivity = current();
if (currentActivity == null) {
throw new NoActivityException();
}
Outcome res = null;
String serviceType = currentActivity.serviceType();
try {
res = currentActivity.end();
} catch (Exception ex) {
wsasLogger.i18NLogger.warn_UserActivityImple_1(ex);
}
HLS hls = HLSManager.getHighLevelService(serviceType);
if (hls != null) {
try {
hls.completed();
} catch (SystemException ex) {
wsasLogger.i18NLogger.warn_UserActivityImple_3(ex);
}
}
pop();
return res;
}
use of com.arjuna.mw.wsas.exceptions.InvalidActivityException 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);
}
}
}
use of com.arjuna.mw.wsas.exceptions.InvalidActivityException in project narayana by jbosstm.
the class ActivityImple method end.
/**
* Complete the activity with the completion status provided.
*
* @param cs The CompletionStatus to use.
*
* @exception InvalidActivityException
* Thrown if the current activity is not known about by the
* activity system.
* @exception WrongStateException
* Thrown if the current activity is not in a state that
* allows it to be completed, or is incompatible with the
* completion status provided.
* @exception ProtocolViolationException
* Thrown if the a violation of the activity service or HLS
* protocol occurs.
* @exception NoPermissionException
* Thrown if the invoking thread does not have permission to
* terminate the transaction.
* @exception SystemException
* Thrown if some other error occurred.
*
* @return the result of completing the activity. Null is valid and must be
* interpreted within the context of any HLS that may exist.
*
* @see com.arjuna.mw.wsas.Outcome
*/
public Outcome end(com.arjuna.mw.wsas.completionstatus.CompletionStatus cs) throws InvalidActivityException, WrongStateException, ProtocolViolationException, NoPermissionException, SystemException {
synchronized (this) {
if (_status.equals(Active.instance())) {
if (activeChildren()) {
throw new InvalidActivityException(wsasLogger.i18NLogger.get_activity_ActivityImple_2() + " " + this);
}
Outcome result = null;
try {
setCompletionStatus(cs);
} catch (Exception ex) {
// ignore and complete with the status we have.
}
_status = Completing.instance();
try {
HLS hls = HLSManager.getHighLevelService(_serviceType);
if (hls != null) {
result = hls.complete(getCompletionStatus());
} else {
result = new OutcomeImple(Failure.instance());
}
} catch (SystemException ex) {
/*
* Currently if an exception occurs and we get here, then we
* forget all of the other outcomes and just return the
* exception. Does this make sense? How will applications be
* able to tell which HLSes have processed the outcome and
* which have not?
*/
result = new OutcomeImple(new HLSException(ex), Failure.instance());
}
if (_parent != null) {
_parent.removeChild(this);
_parent = null;
}
_status = Completed.instance();
_result = result;
return _result;
} else {
if (_result != null)
return _result;
else {
throw new WrongStateException(wsasLogger.i18NLogger.get_activity_ActivityImple_3() + " " + _status);
}
}
}
}
Aggregations