Class XAResourceMngr


  • public class XAResourceMngr
    extends Object
    Utility class used by XA connections for managing XA resources.
    • Field Detail

      • logger

        private static Logger logger
      • DEBUG

        private static final boolean DEBUG
      • ROLLBACK_ONLY

        public static final int ROLLBACK_ONLY
        Failed transaction.
        See Also:
        Constant Field Values
      • transactions

        private Hashtable<Xid,​XAContext> transactions
        The table of known transactions.

        Key: transaction identifier
        Object: XAContext instance

      • cnx

        Connection cnx
        The connection this manager belongs to.
    • Constructor Detail

      • XAResourceMngr

        public XAResourceMngr​(Connection cnx)
        Creates a XAResourceMngr instance.
        Parameters:
        cnx - The connection this manager belongs to.
    • Method Detail

      • start

        void start​(Xid xid,
                   int flag,
                   Session sess)
            throws XAException
        Notifies the RM that a transaction is starting.
        Throws:
        XAException - If the specified transaction is already known by the RM in an incompatible state with the start request.
      • end

        void end​(Xid xid,
                 int flag,
                 Session sess)
          throws XAException
        Notifies the RM that a transaction is ended.
        Throws:
        XAException - If the specified transaction is in an incompatible state with the end request.
      • prepare

        void prepare​(Xid xid)
              throws XAException
        Notifies the RM that a transaction is prepared.
        Throws:
        XAException - If the specified transaction is in an incompatible state with the prepare request, or if the request fails.
      • commit

        void commit​(Xid xid)
             throws XAException
        Notifies the RM that a transaction is commited.
        Throws:
        XAException - If the specified transaction is in an incompatible state with the commit request, or if the request fails.
      • rollback

        void rollback​(Xid xid)
               throws XAException
        Notifies the RM that a transaction is rolled back.
        Throws:
        XAException - If the specified transaction is in an incompatible state with the rollback request, or if the request fails.
      • recover

        Xid[] recover​(int flag)
               throws XAException
        Notifies the RM to recover the prepared transactions.
        Throws:
        XAException - If the specified flag is invalid, or if the request fails.
      • setStatus

        private void setStatus​(Xid xid,
                               int status)
                        throws XAException
        Sets the status of a transaction.
        Throws:
        XAException - If the transaction is unknown.
      • getStatus

        private int getStatus​(Xid xid)
                       throws XAException
        Gets the status of a transaction.
        Throws:
        XAException - If the transaction is unknown.
      • equals

        public boolean equals​(Object o)
        Resource managers are equal if they belong to the same connection.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object