Class 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.
    • Constructor Detail

      • WSATHelper

        protected WSATHelper()
    • Method Detail

      • getInstance

        public static WSATHelper getInstance()
      • 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 - XId
        status - String
        Returns:
        boolean true if the status was set successfully
      • prepare

        public void prepare​(jakarta.xml.ws.EndpointReference epr,
                            Xid xid,
                            WSATXAResource wsatXAResource)
                     throws XAException
        Get/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 reference
        xid - Xid of transaction as obtained from WSATXAResource
        wsatXAResource - WSATXAResource
        Throws:
        XAException - xaException
      • commit

        public void commit​(jakarta.xml.ws.EndpointReference epr,
                           Xid xid,
                           WSATXAResource wsatXAResource)
                    throws XAException
        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.
        Parameters:
        epr - EndpointReference participant endpoint reference
        xid - Xid of transaction as obtained from WSATXAResource
        wsatXAResource - WSATXAResource
        Throws:
        XAException - xaException
      • rollback

        public void rollback​(jakarta.xml.ws.EndpointReference epr,
                             Xid xid,
                             WSATXAResource wsatXAResource)
                      throws XAException
        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.
        Parameters:
        epr - EndpointReference participant endpoint reference
        xid - Xid of transaction as obtained from WSATXAResource
        wsatXAResource - WSATXAResource
        Throws:
        XAException - xaException
      • beforeCompletion

        public void beforeCompletion​(jakarta.xml.ws.EndpointReference epr,
                                     Xid xid,
                                     WSATSynchronization wsatSynchronization)
                              throws jakarta.xml.soap.SOAPException
        beforeCompletion call on volatile participant
        Parameters:
        epr - EndpointReference participant endpoint reference
        xid - Xid of transaction
        wsatSynchronization - 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 reference
        xid - Xid of transaction
        bqual - 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 to
        xid - 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
      • 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()