use of com.arjuna.wst.SystemException in project narayana by jbosstm.
the class TerminationCoordinatorProcessorImpl method cancel.
/**
* Cancel.
* @param cancel The cancel notification.
* @param map The addressing context.
* @param arjunaContext The arjuna context.
*/
public void cancel(final NotificationType cancel, final MAP map, final ArjunaContext arjunaContext) {
final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
final BusinessActivityTerminator participant = getParticipant(instanceIdentifier);
try {
if (participant != null) {
W3CEndpointReference endpoint = participant.getEndpoint();
final String messageId = MessageId.getMessageId();
try {
participant.cancel();
} catch (final FaultedException fe) {
final MAP responseMAP = AddressingHelper.createNotificationContext(messageId);
TerminationParticipantClient.getClient().sendFaulted(endpoint, responseMAP, instanceIdentifier);
} catch (final UnknownTransactionException ute) {
final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_1());
TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
return;
} catch (final SystemException se) {
final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
final String message = WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_2();
final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message);
TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
return;
} catch (final Throwable th) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Unexpected exception thrown from cancel:", th);
}
final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
final SoapFault soapFault = new SoapFault11(th);
TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
return;
}
final MAP responseMAP = AddressingHelper.createNotificationContext(messageId);
TerminationParticipantClient.getClient().sendCancelled(endpoint, responseMAP, instanceIdentifier);
} else {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Cancel called on unknown participant: {0}", new Object[] { instanceIdentifier });
}
final MAP faultMAP = AddressingHelper.createFaultContext(map, MessageId.getMessageId());
final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_5());
TerminationParticipantClient.getClient().sendSoapFault(soapFault, faultMAP, instanceIdentifier);
}
} catch (Throwable throwable) {
throwable.printStackTrace(System.err);
}
}
use of com.arjuna.wst.SystemException in project narayana by jbosstm.
the class TerminationCoordinatorProcessorImpl method complete.
/**
* Complete.
* @param complete The complete notification.
* @param map The addressing context.
* @param arjunaContext The arjuna context.
*/
public void complete(final NotificationType complete, final MAP map, final ArjunaContext arjunaContext) {
final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
final BusinessActivityTerminator participant = getParticipant(instanceIdentifier);
try {
if (participant != null) {
W3CEndpointReference endpoint = participant.getEndpoint();
final String messageId = MessageId.getMessageId();
try {
participant.complete();
} catch (final FaultedException fe) {
final MAP responseMAP = AddressingHelper.createNotificationContext(messageId);
TerminationParticipantClient.getClient().sendFaulted(endpoint, responseMAP, instanceIdentifier);
} catch (final UnknownTransactionException ute) {
final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_12());
TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
return;
} catch (final SystemException se) {
final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
final String message = WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_13();
final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message);
TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
return;
} catch (final Throwable th) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Unexpected exception thrown from complete:", th);
}
final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
final SoapFault soapFault = new SoapFault11(th);
TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
return;
}
final MAP responseMAP = AddressingHelper.createNotificationContext(messageId);
TerminationParticipantClient.getClient().sendCompleted(endpoint, responseMAP, instanceIdentifier);
} else {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Complete called on unknown participant: {0}", new Object[] { instanceIdentifier });
}
final MAP faultMAP = AddressingHelper.createFaultContext(map, MessageId.getMessageId());
final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_16());
TerminationParticipantClient.getClient().sendSoapFault(soapFault, faultMAP, instanceIdentifier);
}
} catch (Throwable throwable) {
throwable.printStackTrace(System.err);
}
}
use of com.arjuna.wst.SystemException in project narayana by jbosstm.
the class TerminationCoordinatorRPCProcessorImpl method complete.
/**
* Complete.
* @param complete The complete notification.
* @param map The addressing context.
* @param arjunaContext The arjuna context.
*/
public void complete(final NotificationType complete, final MAP map, final ArjunaContext arjunaContext) {
final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
final BusinessActivityTerminator participant = TerminationCoordinatorProcessor.getProcessor().getParticipant(instanceIdentifier);
try {
if (participant != null) {
W3CEndpointReference endpoint = participant.getEndpoint();
final String messageId = MessageId.getMessageId();
try {
participant.complete();
} catch (FaultedException fm) {
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.FAULTED_ERROR_CODE_QNAME);
throw new SOAPFaultException(soapFault);
} catch (final UnknownTransactionException ute) {
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_12());
throw new SOAPFaultException(soapFault);
} catch (final SystemException se) {
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_13());
throw new SOAPFaultException(soapFault);
} catch (final Throwable th) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Unexpected exception thrown from close:", th);
}
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_13());
throw new SOAPFaultException(soapFault);
}
} else {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Complete called on unknown participant: {0}", new Object[] { instanceIdentifier });
}
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_12());
throw new SOAPFaultException(soapFault);
}
} catch (SOAPException se) {
se.printStackTrace(System.err);
throw new ProtocolException(se);
}
}
use of com.arjuna.wst.SystemException in project narayana by jbosstm.
the class TerminationCoordinatorRPCProcessorImpl method cancel.
/**
* Cancel.
* @param cancel The cancel notification.
* @param map The addressing context.
* @param arjunaContext The arjuna context.
*/
public void cancel(final NotificationType cancel, final MAP map, final ArjunaContext arjunaContext) {
final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
final BusinessActivityTerminator participant = TerminationCoordinatorProcessor.getProcessor().getParticipant(instanceIdentifier);
try {
if (participant != null) {
try {
participant.cancel();
} catch (FaultedException fm) {
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.FAULTED_ERROR_CODE_QNAME);
throw new SOAPFaultException(soapFault);
} catch (final UnknownTransactionException ute) {
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_1());
throw new SOAPFaultException(soapFault);
} catch (final SystemException se) {
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_2());
throw new SOAPFaultException(soapFault);
} catch (final Throwable th) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Unexpected exception thrown from close:", th);
}
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_2());
throw new SOAPFaultException(soapFault);
}
} else {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Cancel called on unknown participant: {0}", new Object[] { instanceIdentifier });
}
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_5());
throw new SOAPFaultException(soapFault);
}
} catch (SOAPException se) {
se.printStackTrace(System.err);
throw new ProtocolException(se);
}
}
use of com.arjuna.wst.SystemException in project narayana by jbosstm.
the class SubordinateCoordinatorCompletionParticipantStub method cancel.
public void cancel() throws FaultedException, WrongStateException, SystemException {
if (!recovered) {
int result = coordinator.cancel();
if (result != ActionStatus.ABORTED) {
throw new FaultedException("failed to compensate subordinate transaction " + coordinatorId);
}
} else {
XTSBARecoveryManager recoveryManager = null;
boolean isRecoveryScanStarted = false;
if (coordinator == null) {
// try fetching coordinator from the recovery manager
recoveryManager = XTSBARecoveryManager.getRecoveryManager();
// check whether recovery has started before we check for the presence
// of the subordinate coordinator
isRecoveryScanStarted = recoveryManager.isSubordinateCoordinatorRecoveryStarted();
coordinator = SubordinateBACoordinator.getRecoveredCoordinator(coordinatorId);
}
if (coordinator == null) {
// hmm, still null -- see if we have finished recovery scanning
if (!isRecoveryScanStarted) {
// throw an exception causing the commit to be retried later
throw new SystemException();
}
// ok we have no transaction to commit so assume we already committed it and
// return without error
} else if (!coordinator.isActivated()) {
// throw an exception causing the commit to be retried later
throw new SystemException();
} else {
int status = coordinator.status();
if (status == ActionStatus.PREPARED || status == ActionStatus.COMMITTING) {
// ok, the commit process was not previously initiated so start it now
coordinator.cancel();
SubordinateBACoordinator.removeActiveProxy(coordinatorId);
}
if (status == ActionStatus.COMMITTING) {
// throw an exception causing the commit to be retried later
throw new SystemException();
} else if (status != ActionStatus.ABORTED) {
throw new FaultedException();
}
}
}
}
Aggregations