use of com.arjuna.webservices11.wsat.State in project narayana by jbosstm.
the class ParticipantCompletionParticipantEngine method getStatus.
/**
* Handle the getStatus event.
* @param getStatus The getStatus notification.
* @param map The addressing context.
* @param arjunaContext The arjuna context.
*/
public void getStatus(final NotificationType getStatus, final MAP map, final ArjunaContext arjunaContext) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.trace(getClass().getSimpleName() + ".getStatus");
}
final State current;
synchronized (this) {
current = state;
}
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.trace(getClass().getSimpleName() + ".getStatus. State: " + current);
}
sendStatus(current);
}
use of com.arjuna.webservices11.wsat.State in project narayana by jbosstm.
the class ParticipantCompletionParticipantEngine method failed.
/**
* Handle the failed event.
* @param failed The failed notification.
* @param map The addressing context.
* @param arjunaContext The arjuna context.
*
* Active -> Active (invalid state)
* Canceling -> Canceling (invalid state)
* Completed -> Completed (invalid state)
* Closing -> Closing (invalid state)
* Compensating -> Compensating (invalid state)
* Failing-Active -> Ended
* Failing-Canceling -> Ended
* Failing-Compensating -> Ended
* NotCompleting -> NotCompleting (invalid state)
* Exiting -> Exiting (invalid state)
* Ended -> Ended
*/
public void failed(final NotificationType failed, final MAP map, final ArjunaContext arjunaContext) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.trace(getClass().getSimpleName() + ".failed");
}
final State current;
boolean deleteRequired = false;
synchronized (this) {
current = state;
if ((current == State.STATE_FAILING_ACTIVE) || (current == State.STATE_FAILING_CANCELING) || (current == State.STATE_FAILING_COMPENSATING)) {
deleteRequired = persisted;
}
}
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.trace(getClass().getSimpleName() + ".failed. State: " + current);
}
if (deleteRequired) {
if (!XTSBARecoveryManager.getRecoveryManager().deleteParticipantRecoveryRecord(id)) {
// hmm, could not delete entry -- nothing more we can do than log a message
WSTLogger.i18NLogger.warn_wst11_messaging_engines_ParticipantCompletionParticipantEngine_failed_1(id);
}
}
// now the log record has been deleted we can safely end this participant
if ((current == State.STATE_FAILING_ACTIVE) || (current == State.STATE_FAILING_CANCELING) || (current == State.STATE_FAILING_COMPENSATING)) {
ended();
}
}
use of com.arjuna.webservices11.wsat.State in project narayana by jbosstm.
the class BusinessAgreementWithCoordinatorCompletionStub method restoreState.
public boolean restoreState(final InputObjectState ios) {
try {
final String id = ios.unpackString();
final String eprValue = ios.unpackString();
final XMLStreamReader reader = SoapUtils.getXMLStreamReader(new StringReader(eprValue));
StreamHelper.checkNextStartTag(reader, QNAME_BACCWS_PARTICIPANT);
String eprefText = reader.getElementText();
StreamSource source = new StreamSource(new StringReader(eprefText));
final W3CEndpointReference endpointReference = new W3CEndpointReference(source);
String ns = ios.unpackString();
final String localPart = ios.unpackString();
String prefix = ios.unpackString();
if ("".equals(ns)) {
ns = null;
}
if ("".equals(prefix)) {
prefix = null;
}
QName statename = new QName(ns, localPart, prefix);
State state = State.toState11(statename);
// if we already have an engine from a previous recovery scan or because
// we had a heuristic outcome then reuse it with luck it will have been committed
// or aborted between the last scan and this one
// note that whatever happens it will not have been removed from the table
// because it is marked as recovered
participant = (CoordinatorCompletionCoordinatorEngine) CoordinatorCompletionCoordinatorProcessor.getProcessor().getCoordinator(id);
if (participant == null) {
participant = new CoordinatorCompletionCoordinatorEngine(id, endpointReference, state, true);
}
return true;
} catch (final Throwable th) {
WSTLogger.i18NLogger.error_wst11_stub_BusinessAgreementWithCoordinatorCompletionStub_3(th);
return false;
}
}
use of com.arjuna.webservices11.wsat.State in project narayana by jbosstm.
the class ParticipantCompletionCoordinatorEngine method status.
/**
* Handle the status event.
* @param status The status.
* @param map The addressing context.
* @param arjunaContext The arjuna context.
*/
public void status(final StatusType status, final MAP map, final ArjunaContext arjunaContext) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.trace(getClass() + ".status");
}
// TODO - is this correct?
final State current;
synchronized (this) {
current = state;
}
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.trace(getClass() + ".status. State: " + current);
}
sendStatus(current);
}
use of com.arjuna.webservices11.wsat.State in project narayana by jbosstm.
the class ParticipantCompletionCoordinatorEngine method compensate.
/**
* Handle the compensate event.
* @return The state.
*
* Active -> Active (invalid state)
* Canceling -> Canceling (invalid state)
* Completed -> Compensating
* Closing -> Closing (invalid state)
* Compensating -> Compensating
* Failing-Active -> Failing-Active (invalid state)
* Failing-Canceling -> Failing-Canceling (invalid state)
* Failing-Compensating -> Failing-Compensating (invalid state)
* NotCompleting -> NotCompleting (invalid state)
* Exiting -> Exiting (invalid state)
* Ended -> Ended (invalid state)
*/
public State compensate() {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.trace(getClass() + ".compensate");
}
State current;
synchronized (this) {
current = state;
if (current == State.STATE_COMPLETED) {
changeState(State.STATE_COMPENSATING);
}
}
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.trace(getClass() + ".compensate. State: " + current);
}
if ((current == State.STATE_COMPLETED) || (current == State.STATE_COMPENSATING)) {
sendCompensate();
waitForState(State.STATE_COMPENSATING, TransportTimer.getTransportTimeout());
}
synchronized (this) {
if (state != State.STATE_COMPENSATING) {
if (recovered) {
ParticipantCompletionCoordinatorProcessor.getProcessor().deactivateCoordinator(this);
}
if (state == State.STATE_ENDED && failureState != null) {
return failureState;
}
return state;
} else {
// timeout -- leave participant in place as this TX will get retried later
return State.STATE_COMPENSATING;
}
}
}
Aggregations