- java.lang.Object
-
- com.sun.xml.ws.tx.at.WSATHelper<T>
-
public class WSATHelper<T> extends Object
This singleton serves not only as a helper and utility but as the core of the WS-AT resource manager and holds the datastructures that maintain the endpoint references for durable/XAResource and volatile/Synchronization WS-AT transaction participants. Rather than translate back and forth between the WS-AT and internal Xid, the WS-AT could simply be used for the keys in this class, however, we are working with Xids as keys and identity for convenience and better debug logging information as there do not appear to be any substantial performance implications.
-
-
Field Summary
Fields Modifier and Type Field Description protected WSATVersion<T>builderFactorystatic WSATHelperV10static WSATHelperV11
-
Constructor Summary
Constructors Modifier Constructor Description protectedWSATHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringassignUUID()voidbeforeCompletion(jakarta.xml.ws.EndpointReference epr, Xid xid, WSATSynchronization wsatSynchronization)beforeCompletion call on volatile participantvoidcommit(jakarta.xml.ws.EndpointReference epr, Xid xid, WSATXAResource wsatXAResource)Unlike rollback, Xids are not added to the durable participant XAResource map during commit as prepare must always be called in WS-AT (there is no onePhase commit) and prepare must add the Xid to the map.StringgetBQualFromWebServiceContextHeaderList(jakarta.xml.ws.WebServiceContext context)Called by Coordinator to get/create XidStringgetCoordinatorAddress()CoordinatorIF<T>getCoordinatorPort(jakarta.xml.ws.EndpointReference epr, Xid xid)Called from ForeignRecoveryContext.runMap<WSATXAResource,ParticipantIF<T>>getDurableParticipantPortMap()jakarta.transaction.TransactiongetFromXidToTransactionMap(Xid xid)Called by transactionservices enlistResource before calling wsatgatewayrm.enliststatic WSATHelpergetInstance()static WSATHelpergetInstance(com.sun.xml.ws.api.tx.at.Transactional.Version version)StringgetParticipantAddress()ParticipantIF<T>getParticipantPort(jakarta.xml.ws.EndpointReference epr, Xid xid, String bqual)Creates and returns a ParticipantPortType, whether it be durable or volatile, for the provided address, Xid, and reference parameter Elements/NodesStringgetRegistrationCoordinatorAddress()StringgetRegistrationRequesterAddress()StringgetRoutingAddress()static TransactionServicesgetTransactionServices()Return the TransactionServices See interface for details...Map<Xid,ParticipantIF<T>>getVolatileParticipantPortMap()Map<Xid,WSATSynchronization>getVolatileParticipantSynchronizationMap()intgetWaitForReplyTimeout()Amount of time to wait for a reply from a prepare, rollback, commit, or beforeCompletion call before throwing the appropriate exception, errorcode, etc.StringgetWSATTidFromWebServiceContextHeaderList(jakarta.xml.ws.WebServiceContext context)Used by getXidFromWebServiceContextHeaderList in WSATHelper and replayOperation of Coordinator serviceXidgetXidFromWebServiceContextHeaderList(jakarta.xml.ws.WebServiceContext context)Given a WebServiceContext extract and return the WS-AT transaction id and return the translated Xidstatic booleanisDebugEnabled()Need to check if debug is enabled before all logging to prevent unnecessary object creation.voidprepare(jakarta.xml.ws.EndpointReference epr, Xid xid, WSATXAResource wsatXAResource)Get/create participant port and place it in the cache, issue prepare upon it, and place the WSATXAResource in the map.voidputToXidToTransactionMap(Xid xid, jakarta.transaction.Transaction transaction)Called by client side outbound tube where suspended tx is placedvoidremoveFromXidToTransactionMap(Xid xid)voidrollback(jakarta.xml.ws.EndpointReference epr, Xid xid, WSATXAResource wsatXAResource)Rollback can be called before or after prepare so we could do a state check here to avoid the redundant put in the latter case, but it is harmless to re-put and likely not a drastic performance concern.booleansetDurableParticipantStatus(Xid xid, String status)Called by Coordinator in order to update status and unblock async/one-way calls made for durable participants
-
-
-
Field Detail
-
V10
public static final WSATHelper V10
-
V11
public static final WSATHelper V11
-
builderFactory
protected WSATVersion<T> builderFactory
-
-
Method Detail
-
getInstance
public static WSATHelper getInstance()
-
getInstance
public static WSATHelper getInstance(com.sun.xml.ws.api.tx.at.Transactional.Version version)
-
getTransactionServices
public static TransactionServices getTransactionServices()
Return the TransactionServices See interface for details...- Returns:
- TransactionServices which interfaces WS-AT with underlying transaction processing system
-
getWaitForReplyTimeout
public int getWaitForReplyTimeout()
Amount of time to wait for a reply from a prepare, rollback, commit, or beforeCompletion call before throwing the appropriate exception, errorcode, etc.- Returns:
- time in milliseconds
-
setDurableParticipantStatus
public boolean setDurableParticipantStatus(Xid xid, String status)
Called by Coordinator in order to update status and unblock async/one-way calls made for durable participants- Parameters:
xid- XIdstatus- String- Returns:
- boolean true if the status was set successfully
-
prepare
public void prepare(jakarta.xml.ws.EndpointReference epr, Xid xid, WSATXAResource wsatXAResource) throws XAExceptionGet/create participant port and place it in the cache, issue prepare upon it, and place the WSATXAResource in the map.- Parameters:
epr- EndpointReference participant endpoint referencexid- Xid of transaction as obtained from WSATXAResourcewsatXAResource- WSATXAResource- Throws:
XAException- xaException
-
commit
public void commit(jakarta.xml.ws.EndpointReference epr, Xid xid, WSATXAResource wsatXAResource) throws XAExceptionUnlike rollback, Xids are not added to the durable participant XAResource map during commit as prepare must always be called in WS-AT (there is no onePhase commit) and prepare must add the Xid to the map.- Parameters:
epr- EndpointReference participant endpoint referencexid- Xid of transaction as obtained from WSATXAResourcewsatXAResource- WSATXAResource- Throws:
XAException- xaException
-
rollback
public void rollback(jakarta.xml.ws.EndpointReference epr, Xid xid, WSATXAResource wsatXAResource) throws XAExceptionRollback can be called before or after prepare so we could do a state check here to avoid the redundant put in the latter case, but it is harmless to re-put and likely not a drastic performance concern.- Parameters:
epr- EndpointReference participant endpoint referencexid- Xid of transaction as obtained from WSATXAResourcewsatXAResource- WSATXAResource- Throws:
XAException- xaException
-
beforeCompletion
public void beforeCompletion(jakarta.xml.ws.EndpointReference epr, Xid xid, WSATSynchronization wsatSynchronization) throws jakarta.xml.soap.SOAPExceptionbeforeCompletion call on volatile participant- Parameters:
epr- EndpointReference participant endpoint referencexid- Xid of transactionwsatSynchronization- WSATSynchronization- Throws:
jakarta.xml.soap.SOAPException- soapException
-
getParticipantPort
public ParticipantIF<T> getParticipantPort(jakarta.xml.ws.EndpointReference epr, Xid xid, String bqual) throws jakarta.xml.soap.SOAPException
Creates and returns a ParticipantPortType, whether it be durable or volatile, for the provided address, Xid, and reference parameter Elements/Nodes- Parameters:
epr- EndpointReference participant endpoint referencexid- Xid of transactionbqual- String bqual of transaction- Returns:
- ParticipantPortType created
- Throws:
jakarta.xml.soap.SOAPException- soapException
-
getCoordinatorPort
public CoordinatorIF<T> getCoordinatorPort(jakarta.xml.ws.EndpointReference epr, Xid xid)
Called from ForeignRecoveryContext.run- Parameters:
epr- EndpointReference for toxid- Xid to find- Returns:
- CoordinatorIF Coordinator port for Xid
-
getRoutingAddress
public String getRoutingAddress()
-
getRegistrationCoordinatorAddress
public String getRegistrationCoordinatorAddress()
-
getCoordinatorAddress
public String getCoordinatorAddress()
-
getParticipantAddress
public String getParticipantAddress()
-
getRegistrationRequesterAddress
public String getRegistrationRequesterAddress()
-
getXidFromWebServiceContextHeaderList
public Xid getXidFromWebServiceContextHeaderList(jakarta.xml.ws.WebServiceContext context)
Given a WebServiceContext extract and return the WS-AT transaction id and return the translated Xid- Parameters:
context- WebServiceContext- Returns:
- WLXid found in WebServiceContext or fault
-
getWSATTidFromWebServiceContextHeaderList
public String getWSATTidFromWebServiceContextHeaderList(jakarta.xml.ws.WebServiceContext context)
Used by getXidFromWebServiceContextHeaderList in WSATHelper and replayOperation of Coordinator service- Parameters:
context- WebServiceContext- Returns:
- WS-AT Txid String
-
getBQualFromWebServiceContextHeaderList
public String getBQualFromWebServiceContextHeaderList(jakarta.xml.ws.WebServiceContext context)
Called by Coordinator to get/create Xid- Parameters:
context- WebServiceContext- Returns:
- String bqual
-
isDebugEnabled
public static boolean isDebugEnabled()
Need to check if debug is enabled before all logging to prevent unnecessary object creation.- Returns:
- true if debug for the WS-AT logger is enabled, false otherwise
-
getDurableParticipantPortMap
public Map<WSATXAResource,ParticipantIF<T>> getDurableParticipantPortMap()
-
getVolatileParticipantSynchronizationMap
public Map<Xid,WSATSynchronization> getVolatileParticipantSynchronizationMap()
-
getVolatileParticipantPortMap
public Map<Xid,ParticipantIF<T>> getVolatileParticipantPortMap()
-
putToXidToTransactionMap
public void putToXidToTransactionMap(Xid xid, jakarta.transaction.Transaction transaction)
Called by client side outbound tube where suspended tx is placed- Parameters:
xid-transaction-
-
getFromXidToTransactionMap
public jakarta.transaction.Transaction getFromXidToTransactionMap(Xid xid)
Called by transactionservices enlistResource before calling wsatgatewayrm.enlist- Parameters:
xid- Xid- Returns:
- Transaction associated with Xid
-
removeFromXidToTransactionMap
public void removeFromXidToTransactionMap(Xid xid)
-
assignUUID
public static String assignUUID()
-
-