congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
SubordinateBACoordinator
Code IndexAdd Tabnine to your IDE (free)

How to use
SubordinateBACoordinator
in
com.arjuna.mwlabs.wscf.model.sagas.arjunacore.subordinate

Best Java code snippets using com.arjuna.mwlabs.wscf.model.sagas.arjunacore.subordinate.SubordinateBACoordinator (Showing top 20 results out of 315)

origin: org.jboss.jbossts/jbossxts

/**
 * look for recovered subordinate transactions which do not have an associated proxy participant
 * rolling back any that are found. this only needs doing once after the first participant and
 * subordinate transaction recovery passes have both completed
 */
private void cullOrphanedSubordinates()
{
  if (culledOrphanSubordinates || !(subordinateCoordinateRecoveryStarted && participantRecoveryStarted)) {
    return;
  }
  culledOrphanSubordinates = true;
  SubordinateBACoordinator[] coordinators = SubordinateBACoordinator.listRecoveredCoordinators();
  for (SubordinateBACoordinator coordinator : coordinators) {
    if (coordinator.isOrphaned()) {
      RecoveryLogger.i18NLogger.warn_participant_ba_XTSBARecoveryModule_5(coordinator.get_uid());
      coordinator.cancel();
    }
  }
}
origin: org.jboss.jbossts.xts/jbossxts

/**
 * test whether a transaction has been restored without its proxy participant. this indicates that
 * we crashed between preparing the suborindate TX and logging the proxy participant.
 * @return
 */
public boolean isOrphaned()
{
  String id = get_uid().stringForm();
  if (isActiveProxy(id)) {
    return false;
  }
  // the proxy may have been removed because this tx has been resolved while we were checking
  if (getRecoveredCoordinator(id) == null) {
    return false;
  }
  // ok we have a tx but no proxy so this is really an orphan
  
  return true;
}
origin: org.jboss.jbossts/jbossxts

/**
 * run parent activate and also make this coordinator visible if there might be a durable participant waiting
 * for it to commit.
 * @return
 */
public boolean activate()
{
  boolean result = super.activate();
  // if we cannot activate we want the participant which was registered on behalf of this
  // coordinator to produce a heuristic result for the transaction. it will do this if it
  // finds no entry for the coordinate in the subordinate coordinators list. in this case
  // the subordinate transaction record needs to left as is awaiting manual intervention.
  if (result) {
    // record that the activation worked
    setActivated();
    int status = status();
    if (status == ActionStatus.PREPARED || status == ActionStatus.COMMITTING) {
      // we need to install this coordinator in a global table so that the participant which
      // was driving it will know that it has been recovered but not yet committed
      SubordinateBACoordinator.addRecoveredCoordinator(this);
    }
  }
  return result;
}
origin: org.jboss.jbossts/jbossxts

/**
 * this is driven by a coordinator-completion participant registered on behalf of the coordinator
 * and is required to propagate the cancel to all registered participants.
 */
public int cancel ()
{
  int status = status();
  int result;
  // TODO -- check if there is a window here where status could change to COMMITTING
  if (status == ActionStatus.COMMITTING) {
    phase2Abort(true);
    result = status();
  } else {
    result = super.cancel();
  }
  SubordinateBACoordinator.removeRecoveredCoordinator(this);
  // run any callback associated with this transaction
  runCallback(get_uid().stringForm());
  return result;
}
origin: org.jboss.jbossts.xts/ws-t11

public void compensate() throws FaultedException, WrongStateException, SystemException {
  if (!recovered) {
    int result = coordinator.cancel();
      coordinator = SubordinateBACoordinator.getRecoveredCoordinator(coordinatorId);
    } else if(!coordinator.isActivated()) {
      int status = coordinator.status();
        coordinator.cancel();
        SubordinateBACoordinator.removeActiveProxy(coordinatorId);
        status = coordinator.status();
origin: org.jboss.jbossts.xts/jbossxts

int result;
try {
  result = coordinator.close();
} catch (com.arjuna.mw.wsas.exceptions.SystemException se) {
  throw new SystemException(se.getMessage());
  coordinator = SubordinateBACoordinator.getRecoveredCoordinator(coordinatorId);
} else if(!coordinator.isActivated()) {
  int status = coordinator.status();
      coordinator.close();
      SubordinateBACoordinator.removeActiveProxy(coordinatorId);
    } catch (com.arjuna.mw.wsas.exceptions.SystemException e) {
    status = coordinator.status();
origin: org.jboss.jbossts.xts/jbossxts

/**
 * this is driven by a coordinator-completion participant registered on behalf of the coordinator
 * and is required to propagate the close to all registered participants.
 */
public int close () throws SystemException
{
  int status = status();
  int result;
  if (status == ActionStatus.COMMITTING) {
    // TODO -- need to do completion processing here?
    // we already completed and ran phase 1 so do a phase 2 commit
    phase2Commit(true);
    result = status();
  } else {
    // we have not yet completed so we can rely upon the parent implementation to do
    // everything we need
    result = super.close();
  }
  // if we have completed then remove the coordinator from the recovered coordinators table
  if (status() != ActionStatus.COMMITTING) {
    SubordinateBACoordinator.removeRecoveredCoordinator(this);
  }
  // run any callback associated with this transaction
  runCallback(get_uid().stringForm());
  return result;
}
origin: org.jboss.jbossts.xts/ws-t11

public SubordinateCoordinatorCompletionParticipantStub(SubordinateBACoordinator coordinator)
{
  this.coordinator = coordinator;
  this.coordinatorId = coordinator.get_uid().stringForm();
  this.recovered = false;
  this.manager = null;
}
origin: org.jboss.jbossts.xts/wstx11

String ccpid = subTx.getCoordinatorCompletionParticipantid();
SubordinateCoordinatorCompletionParticipantStub ccp = new SubordinateCoordinatorCompletionParticipantStub(subTx);
String messageId = MessageId.getMessageId() ;
coordinationContext.setCoordinationType(coordinationTypeURI);
CoordinationContextType.Identifier identifier = new CoordinationContextType.Identifier();
String txId = subTx.get_uid().stringForm();
identifier.setValue("urn:" + txId);
coordinationContext.setIdentifier(identifier) ;
origin: org.jboss.jbossts/jbossxts

public void complete() throws WrongStateException, SystemException {
  if (!recovered) {
    // the coordinator will send complete to all participants and then
    // also run phase one commit. the former may throw an exception.
    // if the latter succeeds the tx state will be COMMITTING whereas
    // if it fails it will be ABORTED.
    try {
      coordinator.complete();
    } catch (com.arjuna.mw.wsas.exceptions.WrongStateException wse) {
      throw new WrongStateException(wse.getMessage());
    } catch (com.arjuna.mw.wsas.exceptions.SystemException se) {
      throw new SystemException(se.getMessage());
    }
    // if status is COMMITTING then we return allowing the participant to be logged
    // if status is ABORTED then the participant must fail avoiding any logging
    if (coordinator.status() == ActionStatus.ABORTED) {
      manager.fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME);
    } else {
      // null out the manager so we don't attempt to save it to the log
      manager = null;
    }
  } else {
    // we should never get asked to complete a recovered activity
    throw new WrongStateException();
  }
}
origin: org.jboss.jbossts/jbossxts

if (SubordinateBACoordinator.getRecoveredCoordinator(recoverUid.stringForm()) != null) {
  return;
origin: org.jboss.jbossts.xts/wstx11

public void exit () throws WrongStateException, UnknownTransactionException, SystemException
{
  try {
    _theTx.delistParticipant(_participantId);
  } catch (com.arjuna.mw.wscf.exceptions.InvalidParticipantException ex) {
    throw new SystemException("UnknownParticipantException");
  } catch (com.arjuna.mw.wsas.exceptions.WrongStateException ex) {
    throw new WrongStateException();
  } catch (com.arjuna.mw.wsas.exceptions.SystemException ex) {
    throw new SystemException(ex.toString());
  }
}
origin: org.jboss.jbossts.xts/jbossxts

/**
 * Restore the state of the particpant from the specified input object stream.
 * @param ios The Input object stream.
 * @return true if restored, false otherwise.
 */
public boolean restoreState(InputObjectState ios) {
  // restore the subordinate coordinator id so we can check to ensure it has been committed
  try {
    coordinatorId = ios.unpackString();
    SubordinateBACoordinator.addActiveProxy(coordinatorId);
    return true;
  } catch (IOException e) {
    return false;
  }
}
origin: org.jboss.jbossts/jbossxts

SubordinateBACoordinator.addCallback(subordinateId, callback);
origin: org.jboss.jbossts.xts/jbossxts

public void compensate() throws FaultedException, WrongStateException, SystemException {
  if (!recovered) {
    int result = coordinator.cancel();
      coordinator = SubordinateBACoordinator.getRecoveredCoordinator(coordinatorId);
    } else if(!coordinator.isActivated()) {
      int status = coordinator.status();
        coordinator.cancel();
        SubordinateBACoordinator.removeActiveProxy(coordinatorId);
        status = coordinator.status();
origin: org.jboss.jbossts/jbossxts

int result;
try {
  result = coordinator.close();
} catch (com.arjuna.mw.wsas.exceptions.SystemException se) {
  throw new SystemException(se.getMessage());
  coordinator = SubordinateBACoordinator.getRecoveredCoordinator(coordinatorId);
} else if(!coordinator.isActivated()) {
  int status = coordinator.status();
      coordinator.close();
      SubordinateBACoordinator.removeActiveProxy(coordinatorId);
    } catch (com.arjuna.mw.wsas.exceptions.SystemException e) {
    status = coordinator.status();
origin: org.jboss.jbossts.xts/jbossxts

/**
 * this is driven by a coordinator-completion participant registered on behalf of the coordinator
 * and is required to propagate the cancel to all registered participants.
 */
public int cancel ()
{
  int status = status();
  int result;
  // TODO -- check if there is a window here where status could change to COMMITTING
  if (status == ActionStatus.COMMITTING) {
    phase2Abort(true);
    result = status();
  } else {
    result = super.cancel();
  }
  SubordinateBACoordinator.removeRecoveredCoordinator(this);
  // run any callback associated with this transaction
  runCallback(get_uid().stringForm());
  return result;
}
origin: org.jboss.jbossts/jbossxts

/**
 * this is driven by a coordinator-completion participant registered on behalf of the coordinator
 * and is required to propagate the close to all registered participants.
 */
public int close () throws SystemException
{
  int status = status();
  int result;
  if (status == ActionStatus.COMMITTING) {
    // TODO -- need to do completion processing here?
    // we already completed and ran phase 1 so do a phase 2 commit
    phase2Commit(true);
    result = status();
  } else {
    // we have not yet completed so we can rely upon the parent implementation to do
    // everything we need
    result = super.close();
  }
  // if we have completed then remove the coordinator from the recovered coordinators table
  if (status() != ActionStatus.COMMITTING) {
    SubordinateBACoordinator.removeRecoveredCoordinator(this);
  }
  // run any callback associated with this transaction
  runCallback(get_uid().stringForm());
  return result;
}
origin: org.jboss.jbossts/jbossxts

public SubordinateCoordinatorCompletionParticipantStub(SubordinateBACoordinator coordinator)
{
  this.coordinator = coordinator;
  this.coordinatorId = coordinator.get_uid().stringForm();
  this.recovered = false;
  this.manager = null;
}
origin: org.jboss.jbossts.xts/jbossxts

String ccpid = subTx.getCoordinatorCompletionParticipantid();
SubordinateCoordinatorCompletionParticipantStub ccp = new SubordinateCoordinatorCompletionParticipantStub(subTx);
String messageId = MessageId.getMessageId() ;
coordinationContext.setCoordinationType(coordinationTypeURI);
CoordinationContextType.Identifier identifier = new CoordinationContextType.Identifier();
String txId = subTx.get_uid().stringForm();
identifier.setValue("urn:" + txId);
coordinationContext.setIdentifier(identifier) ;
com.arjuna.mwlabs.wscf.model.sagas.arjunacore.subordinateSubordinateBACoordinator

Javadoc

This class represents a specific coordination instance. It inherits from ArjunaCore TwoPhaseCoordinator via the BACoordinator. This is the subordinate coordinator implementation which we use when doing interposition. This implementation registers itself as a coordinator completion participant in its parent activity. It has to use the coordinator completion protocol because it relies upon dispatch of a complete request from the parent to drive logging of i) the subordinate transaction state then ii) the state of its registered proxy participant. These operations must both happen in that order and only when the parent transaction is preparing to close. Note that this does not imply that the transaction is closed, merely that it goes through phase 1 of the transaction termination protocol (PREPARE) leaving a transaction log record on the disk (albeit in state COMMITTING). It must still be possible to leave phase 2 open for either close (COMMIT) or compensate (ROLLBACK). Why? Well, if the participant logs its state first either at parent complete or, if participant completion is in use, before parent complete, then a crash risks losing details of the subordinate transaction -- including potentialy completed participants which may require closing or compensating. Note that this danger bypasses any question of whether or when subsequently the subordinate transaction state might be logged -- the participant cannot log its state and guarantee to close or compensate correctly without having first ensured that it can guarantee to close or compensate subordinate participants. Contrariwise, if the subordinate transaction logs its state first and a crash occurs before the proxy participant state can be saved then it is still possible during recovery to correlate the presence of the logged subordinate transaction with the absence of its proxy participant and automatically compensate the subordinate transaction's completed participants. This will match the action of the parent since absence of the proxy participant requires it also to compensate. It is not possible to commit any earlier than parent complete because it is still legitimate for participants to register before that event. So, the implication of this is that when the proxy notifies complete to this coordinator it must perform the usual complete processing and also drive phase 1 of the commit process. Later, when a close request is dispatched, it can drive phase 2 of the commit process. If there is a failure during phase 1 of the commit process then the subordinate transaction will not be logged. In this case the proxy participant must notify a fail to the parent transaction and avoid logging its own state. This is safe because a crash will automatically cause a subsequent resend of the complete request to return fail because the proxy participant is unknown. If phase 1 completes successfully then the proxy participant must log its state and notify completed to the parent trasaction. If a crash occurs between logging the subordinate transaction state and logging the proxy state then the absence of the proxy participant can be reconciled during recovery and the subordinate transaction can be automatically compensated. If a crash occurs between logging the proxy participant and notifying completed to the parent transaction then the participant will be recreated during recovery and a subsequent resend of complete can be answered with completed. Note that this means complete requests for unknown participants must only be answered after the first pass of the BA participant recovery module has completed.

Most used methods

  • get_uid
  • cancel
    this is driven by a coordinator-completion participant registered on behalf of the coordinator and i
  • getRecoveredCoordinator
  • activate
  • addActiveProxy
  • addCallback
    register a callback to be called when a subordinate transaction with a specific key executes a commi
  • addRecoveredCoordinator
  • close
    this is driven by a coordinator-completion participant registered on behalf of the coordinator and i
  • complete
    this is driven by a coordinator-completion participant registered on behalf of the coordinator and i
  • delistParticipant
  • enlistParticipant
  • getCoordinatorCompletionParticipantid
    return a uid for the corodinator completion participant registered on behalf of this coordinator
  • enlistParticipant,
  • getCoordinatorCompletionParticipantid,
  • isActivated,
  • isOrphaned,
  • listRecoveredCoordinators,
  • participantCannotComplete,
  • participantCompleted,
  • participantFaulted,
  • phase2Abort,
  • removeActiveProxy

Popular in Java

  • Creating JSON documents from java classes using gson
  • runOnUiThread (Activity)
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now