use of org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager in project narayana by jbosstm.
the class CoordinatorCompletionParticipantProcessorImpl method compensate.
/**
* Compensate.
* @param compensate The compensate notification.
* @param map The addressing context.
* @param arjunaContext The arjuna context.
*/
public void compensate(final NotificationType compensate, final MAP map, final ArjunaContext arjunaContext) {
final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
/**
* ensure the BA participant recovery manager is running
*/
XTSBARecoveryManager recoveryManager = XTSBARecoveryManager.getRecoveryManager();
if (recoveryManager == null) {
// log warning and drop this message -- it will be resent
WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_compensate_3(instanceIdentifier.toString());
return;
}
final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
if (participant != null) {
try {
participant.compensate(compensate, map, arjunaContext);
} catch (final Throwable th) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Unexpected exception thrown from compensate:", th);
}
}
} else if (!recoveryManager.isParticipantRecoveryStarted()) {
WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_compensate_4(instanceIdentifier.toString());
} else if (recoveryManager.findParticipantRecoveryRecord(instanceIdentifier.getInstanceIdentifier()) != null) {
WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_compensate_5(instanceIdentifier.toString());
} else {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Compensate called on unknown participant: {0}", new Object[] { instanceIdentifier });
}
sendCompensated(map, arjunaContext);
}
}
use of org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager in project narayana by jbosstm.
the class ParticipantCompletionParticipantProcessorImpl method compensate.
/**
* Compensate.
* @param compensate The compensate notification.
* @param map The addressing context.
* @param arjunaContext The arjuna context.
*/
public void compensate(final NotificationType compensate, final MAP map, final ArjunaContext arjunaContext) {
final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
/**
* ensure the BA participant recovery manager is running
*/
XTSBARecoveryManager recoveryManager = XTSBARecoveryManager.getRecoveryManager();
if (recoveryManager == null) {
// log warning and drop this message -- it will be resent
WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantCompletionParticipantProcessorImpl_compensate_3(instanceIdentifier.toString());
return;
}
final ParticipantCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
if (participant != null) {
try {
participant.compensate(compensate, map, arjunaContext);
} catch (final Throwable th) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Unexpected exception thrown from compensate:", th);
}
}
} else if (!recoveryManager.isParticipantRecoveryStarted()) {
WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantCompletionParticipantProcessorImpl_compensate_4(instanceIdentifier.toString());
} else if (recoveryManager.findParticipantRecoveryRecord(instanceIdentifier.getInstanceIdentifier()) != null) {
WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantCompletionParticipantProcessorImpl_compensate_5(instanceIdentifier.toString());
} else {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Compensate called on unknown participant: {0}", new Object[] { instanceIdentifier });
}
sendCompensated(map, arjunaContext);
}
}
use of org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager in project narayana by jbosstm.
the class ParticipantCompletionParticipantProcessorImpl 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();
/**
* ensure the BA participant recovery manager is running
*/
XTSBARecoveryManager recoveryManager = XTSBARecoveryManager.getRecoveryManager();
if (recoveryManager == null) {
// log warning and drop this message -- it will be resent
WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantCompletionParticipantProcessorImpl_cancel_3(instanceIdentifier.toString());
return;
}
final ParticipantCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
if (participant != null) {
try {
participant.cancel(cancel, map, arjunaContext);
} catch (final Throwable th) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Unexpected exception thrown from cancel:", th);
}
}
} else if (!recoveryManager.isParticipantRecoveryStarted()) {
WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantCompletionParticipantProcessorImpl_cancel_4(instanceIdentifier.toString());
} else if (recoveryManager.findParticipantRecoveryRecord(instanceIdentifier.getInstanceIdentifier()) != null) {
WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantCompletionParticipantProcessorImpl_cancel_5(instanceIdentifier.toString());
} else {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Cancel called on unknown participant: {0}", new Object[] { instanceIdentifier });
}
sendCancelled(map, arjunaContext);
}
}
use of org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager in project narayana by jbosstm.
the class SubordinateCoordinatorCompletionParticipantStub method close.
public void close() throws WrongStateException, SystemException {
if (!recovered) {
int result;
try {
result = coordinator.close();
} catch (com.arjuna.mw.wsas.exceptions.SystemException se) {
throw new SystemException(se.getMessage());
}
if (result != ActionStatus.COMMITTED) {
throw new SystemException("failed to close 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
try {
coordinator.close();
SubordinateBACoordinator.removeActiveProxy(coordinatorId);
} catch (com.arjuna.mw.wsas.exceptions.SystemException e) {
// throw an exception causing the commit to be retried later
throw new SystemException();
}
status = coordinator.status();
}
if (status == ActionStatus.COMMITTING) {
// throw an exception causing the commit to be retried later
throw new SystemException();
}
}
}
}
use of org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager in project narayana by jbosstm.
the class SubordinateCoordinatorCompletionParticipantStub method compensate.
public void compensate() throws FaultedException, WrongStateException, SystemException {
if (!recovered) {
int result = coordinator.cancel();
// test result and throw a SystemException if the compensate was delayed
} 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);
status = coordinator.status();
}
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