Class ActiveMQRAXAResource

  • All Implemented Interfaces:
    javax.transaction.xa.XAResource, org.apache.activemq.artemis.core.client.impl.ActiveMQXAResource

    public class ActiveMQRAXAResource
    extends java.lang.Object
    implements org.apache.activemq.artemis.core.client.impl.ActiveMQXAResource
    ActiveMQXAResource.
    • Field Summary

      • Fields inherited from interface javax.transaction.xa.XAResource

        TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void commit​(javax.transaction.xa.Xid xid, boolean onePhase)
      Commit
      void end​(javax.transaction.xa.Xid xid, int flags)
      End
      void forget​(javax.transaction.xa.Xid xid)
      Forget
      javax.transaction.xa.XAResource getResource()  
      int getTransactionTimeout()
      Get the transaction timeout in seconds
      boolean isSameRM​(javax.transaction.xa.XAResource xaRes)
      IsSameRM
      int prepare​(javax.transaction.xa.Xid xid)
      Prepare
      javax.transaction.xa.Xid[] recover​(int flag)
      Recover
      void rollback​(javax.transaction.xa.Xid xid)
      Rollback
      boolean setTransactionTimeout​(int seconds)
      Set the transaction timeout
      void start​(javax.transaction.xa.Xid xid, int flags)
      Start
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ActiveMQRAXAResource

        public ActiveMQRAXAResource​(ActiveMQRAManagedConnection managedConnection,
                                    javax.transaction.xa.XAResource xaResource)
        Create a new ActiveMQXAResource.
        Parameters:
        managedConnection - the managed connection
        xaResource - the xa resource
    • Method Detail

      • start

        public void start​(javax.transaction.xa.Xid xid,
                          int flags)
                   throws javax.transaction.xa.XAException
        Start
        Specified by:
        start in interface javax.transaction.xa.XAResource
        Parameters:
        xid - A global transaction identifier
        flags - One of TMNOFLAGS, TMJOIN, or TMRESUME
        Throws:
        javax.transaction.xa.XAException - An error has occurred
      • end

        public void end​(javax.transaction.xa.Xid xid,
                        int flags)
                 throws javax.transaction.xa.XAException
        End
        Specified by:
        end in interface javax.transaction.xa.XAResource
        Parameters:
        xid - A global transaction identifier
        flags - One of TMSUCCESS, TMFAIL, or TMSUSPEND.
        Throws:
        javax.transaction.xa.XAException - An error has occurred
      • prepare

        public int prepare​(javax.transaction.xa.Xid xid)
                    throws javax.transaction.xa.XAException
        Prepare
        Specified by:
        prepare in interface javax.transaction.xa.XAResource
        Parameters:
        xid - A global transaction identifier
        Returns:
        XA_RDONLY or XA_OK
        Throws:
        javax.transaction.xa.XAException - An error has occurred
      • commit

        public void commit​(javax.transaction.xa.Xid xid,
                           boolean onePhase)
                    throws javax.transaction.xa.XAException
        Commit
        Specified by:
        commit in interface javax.transaction.xa.XAResource
        Parameters:
        xid - A global transaction identifier
        onePhase - If true, the resource manager should use a one-phase commit protocol to commit the work done on behalf of xid.
        Throws:
        javax.transaction.xa.XAException - An error has occurred
      • rollback

        public void rollback​(javax.transaction.xa.Xid xid)
                      throws javax.transaction.xa.XAException
        Rollback
        Specified by:
        rollback in interface javax.transaction.xa.XAResource
        Parameters:
        xid - A global transaction identifier
        Throws:
        javax.transaction.xa.XAException - An error has occurred
      • forget

        public void forget​(javax.transaction.xa.Xid xid)
                    throws javax.transaction.xa.XAException
        Forget
        Specified by:
        forget in interface javax.transaction.xa.XAResource
        Parameters:
        xid - A global transaction identifier
        Throws:
        javax.transaction.xa.XAException - An error has occurred
      • isSameRM

        public boolean isSameRM​(javax.transaction.xa.XAResource xaRes)
                         throws javax.transaction.xa.XAException
        IsSameRM
        Specified by:
        isSameRM in interface javax.transaction.xa.XAResource
        Parameters:
        xaRes - An XAResource object whose resource manager instance is to be compared with the resource manager instance of the target object.
        Returns:
        True if its the same RM instance; otherwise false.
        Throws:
        javax.transaction.xa.XAException - An error has occurred
      • recover

        public javax.transaction.xa.Xid[] recover​(int flag)
                                           throws javax.transaction.xa.XAException
        Recover
        Specified by:
        recover in interface javax.transaction.xa.XAResource
        Parameters:
        flag - One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS
        Returns:
        Zero or more XIDs
        Throws:
        javax.transaction.xa.XAException - An error has occurred
      • getTransactionTimeout

        public int getTransactionTimeout()
                                  throws javax.transaction.xa.XAException
        Get the transaction timeout in seconds
        Specified by:
        getTransactionTimeout in interface javax.transaction.xa.XAResource
        Returns:
        The transaction timeout
        Throws:
        javax.transaction.xa.XAException - An error has occurred
      • setTransactionTimeout

        public boolean setTransactionTimeout​(int seconds)
                                      throws javax.transaction.xa.XAException
        Set the transaction timeout
        Specified by:
        setTransactionTimeout in interface javax.transaction.xa.XAResource
        Parameters:
        seconds - The number of seconds
        Returns:
        True if the transaction timeout value is set successfully; otherwise false.
        Throws:
        javax.transaction.xa.XAException - An error has occurred
      • getResource

        public javax.transaction.xa.XAResource getResource()
        Specified by:
        getResource in interface org.apache.activemq.artemis.core.client.impl.ActiveMQXAResource