Methods Summary |
---|
public void | addRegistrant(com.sun.xml.ws.tx.coordinator.Registrant registrant, javax.xml.ws.WebServiceContext wsContext)
//
if (registerWithRootRegistrationService(registrant)) {
// registrant is either volatile or durable participant with subordinate coordinator's parent coordinator.
// do not add this participant to ATSubCoordinator list of participants it is managing.
return;
}
super.addRegistrant(registrant, wsContext);
switch (registrant.getProtocol()) {
case VOLATILE:
registerWithVolatileParent();
break;
case DURABLE:
registerWithDurableParent();
break;
case COMPLETION:
throw new UnsupportedOperationException("can not register for completion with subordinate coordinator");
}
|
public void | afterCompletion(int i)
// Ensure that afterCompletion disabled for subordinate coordinator
throw new UnsupportedOperationException("No afterCompletion for subordinate coordinator");
|
public void | beforeCompletion()Subordinate Coordinator does not use this mechanism. Ensure it is not called.
// Ensure that beforeCompletion disabled for subordinate coordinator
// Subordinate coordinator should not be registered with TransactionSynchronizationRegistry.
throw new UnsupportedOperationException("No beforeCompletion for subordinate coordinator");
|
public void | beginImportTransaction()Import a transactional context from an external transaction manager via WS-AT Coordination Context
that was propagated in a SOAP request message.
Transaction currentTxn = null;
try {
importTm.recreate(getCoordinationXid(), getExpires());
} catch (IllegalStateException ex) {
String message = LocalizationMessages.IMPORT_TRANSACTION_FAILED_0028(getIdValue(),
getCoordinationXid().toString());
logger.warning("beginImportTransaction", message, ex);
throw new WebServiceException(message, ex);
}
try{
currentTxn = tm.getTransaction();
} catch (SystemException ex) {
String message = LocalizationMessages.IMPORT_TXN_GET_TXN_FAILED_0030(getIdValue());
logger.warning("beginImportTransaction", message, ex);
throw new WebServiceException(message, ex);
}
assert currentTxn != null;
setTransaction(currentTxn);
tm.setCoordinationContext(getContext());
|
public void | commit(javax.transaction.xa.Xid xid, boolean onePhase)
if (logger.isLogging(Level.FINER)) {
logger.entering("XAResource_commit(xid=" + xid + " ,onePhase=" + onePhase + ")");
}
// TODO: Commit AT Subordinate Coordinator state so it can be recovered in case of failure.
// Only durable participants need to be recoverable.
// This coordinator commits when root ws-at coordinator sends a prepare to this subordinate
// coordinator that is a participant to that coordinator.
if (logger.isLogging(Level.FINER)) {
logger.exiting("XAResource_commit");
}
|
public void | endImportTransaction()Ends the importing of an external transaction.
Post-condition: terminates beginImportTransaction.
if (transaction != null) {
try {
importTm.release(getCoordinationXid());
} catch (Error e) {
logger.warning("endImportTransaction",
LocalizationMessages.EXCEPTION_RELEASING_IMPORTED_TRANSACTION_0029(), e);
}
setTransaction(null);
}
|
public boolean | expirationGuard()
synchronized (this) {
return guardTimeout;
}
|
public void | forget(java.lang.String partId)
if (rootVolatileParticipant != null && rootVolatileParticipant.getIdValue().equals(partId)) {
rootVolatileParticipant = null;
if (logger.isLogging(Level.FINE)) {
logger.fine("forget", "forgot volatile participant link to parent " + getCoordIdPartId(partId));
}
if (!hasOutstandingParticipants()) {
forget();
}
return;
}
if (rootDurableParticipant != null && rootDurableParticipant.getIdValue().equals(partId)) {
rootDurableParticipant = null;
if (logger.isLogging(Level.FINE)) {
logger.fine("forget", "forgot durable participant link to parent " + getCoordIdPartId(partId));
}
if (!hasOutstandingParticipants()) {
forget();
}
return;
}
// see if just a regular participant of this coordinator
super.forget(partId);
|
public void | forget()
synchronized(this) {
if (forgotten) {
return;
} else {
forgotten = true;
}
if (rootVolatileParticipant != null){
rootVolatileParticipant.forget();
rootVolatileParticipant = null;
}
if (rootDurableParticipant != null){
rootDurableParticipant.forget();
rootDurableParticipant = null;
}
CoordinationXid.forget(this.getIdValue());
super.forget();
}
|
public javax.transaction.xa.Xid | getCoordinationXid()
if (xid == null) {
xid = CoordinationXid.lookupOrCreate(getContext().getIdentifier());
}
return xid;
|
public com.sun.xml.ws.tx.coordinator.Registrant | getRegistrant(java.lang.String id)Get the registrant with the specified id or null if it does not exist.
Registrant result = super.getRegistrant(id);
// check subordinate participants
if (result == null && rootVolatileParticipant != null &&
rootVolatileParticipant.getIdValue().equals(id)) {
result = rootVolatileParticipant;
}
if (result == null && rootDurableParticipant != null &&
rootDurableParticipant.getIdValue().equals(id)) {
result = rootDurableParticipant;
}
return result;
|
private javax.resource.spi.XATerminator | getXATerminator()
if (xaTerminator == null) {
xaTerminator = importTm.getXATerminator();
}
return xaTerminator;
|
public boolean | hasOutstandingParticipants()
return rootDurableParticipant != null || rootVolatileParticipant != null || super.hasOutstandingParticipants();
|
public boolean | isSubordinateCoordinator()
return true;
|
public int | prepare(javax.transaction.xa.Xid xid)Synchronous prepare request from subordinate coordinator.
Prepare this coordinator and return result of preparation.
if (logger.isLogging(Level.FINER)) {
logger.entering("XAResource_prepare(xid=" + xid + ")");
}
int result = 0;
result = XA_OK;
// TODO: Prepare AT Subordinate Coordinator state so it can be recovered in case of failure.
// Only durable participants need to be recoverable.
// This coordinator prepares when root ws-at coordinator sends a prepare to this subordinate
// coordinator that is a participant to that coordinator.
if (logger.isLogging(Level.FINER)) {
logger.exiting("XAResource_prepare", result);
}
return result;
|
protected boolean | registerWithDurableParent()
boolean result = false;
if (rootDurableParticipant == null) {
if (logger.isLogging(Level.FINE)) {
logger.fine("ATSubCoordinator.registerWithDurableParent", "register durable2PC with coordId:" +
getIdValue());
}
rootDurableParticipant = new ATParticipant(this, new DurableParticipant());
try {
rootDurableParticipant.register();
result = true;
} catch (Exception e) {
// TODO: ROBUSTNESS retry register when it fails
logger.severe("registerWithDurableParent", LocalizationMessages.REG_WITH_DURABLE_FAILED_0022(getCoordIdPartId(rootDurableParticipant)));
}
}
return result;
|
public boolean | registerWithRootRegistrationService(com.sun.xml.ws.tx.coordinator.Registrant participant)Represent all volatile and durable participants for this subordinate coordinator through
two special participants of SubordinateCoordinator. They are the only participants that parent
coordinator is aware of.
// Note: intended instance comparision, not object comparison
if (participant == rootVolatileParticipant || participant == rootDurableParticipant) {
return true;
} else {
return super.registerWithRootRegistrationService(participant);
}
|
protected void | registerWithVolatileParent()
if (rootVolatileParticipant == null) {
if (logger.isLogging(Level.FINE)) {
logger.fine("ATSubCoordinator.registerWithVolatileParent", "register volatile2PC with coordId:" +
getIdValue());
}
rootVolatileParticipant = new ATParticipant(this, new VolatileParticipant());
rootVolatileParticipant.register();
}
|
public void | removeRegistrant(java.lang.String id)
forget(id);
|
public void | rollback(javax.transaction.xa.Xid xid)
if (logger.isLogging(Level.FINER)) {
logger.entering("XAResource_rollback(xid=" + xid + ")");
}
// TODO: Rollack AT Subordinate Coordinator state.
// Only durable participants require to be rolled back.
// This coordinator rolls back when root ws-at coordinator sends a abort to this subordinate
// coordinator that is a participant to that coordinator.
if (logger.isLogging(Level.FINER)) {
logger.exiting("XAResource_rollback");
}
|
public void | setTransaction(javax.transaction.Transaction txn)
super.setTransaction(txn);
if (txn == null) {
xaTerminator = null;
} else if (xaTerminator == null) {
xaTerminator = importTm.getXATerminator();
}
|