Class GenericXaResource

  • All Implemented Interfaces:
    java.lang.Runnable, javax.transaction.xa.XAResource
    Direct Known Subclasses:
    DebugXaResource, ServiceXaWrapper

    public abstract class GenericXaResource
    extends java.lang.Thread
    implements javax.transaction.xa.XAResource
    GenericXaResource - Abstract XA Resource implementation supporting a single transaction
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean active  
      static java.lang.String module  
      protected java.lang.Integer timeout
      timeout is an Integer and defaults to null so that we know if it is set on this object; if it isn't set we won't worry about the warning message, etc because we don't know what the real timeout is
      protected javax.transaction.Transaction trans  
      protected javax.transaction.xa.Xid xid  
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
      • 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 Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void commit​(javax.transaction.xa.Xid xid, boolean onePhase)  
      void end​(javax.transaction.xa.Xid xid, int flag)  
      void enlist()
      Enlists this resource in the current transaction
      void enlist​(javax.transaction.Transaction tx)
      Enlists this resource in the current transaction
      void forget​(javax.transaction.xa.Xid xid)  
      javax.transaction.Transaction getTransaction()  
      int getTransactionTimeout()  
      javax.transaction.xa.Xid getXid()  
      boolean isSameRM​(javax.transaction.xa.XAResource xaResource)  
      int prepare​(javax.transaction.xa.Xid xid)  
      javax.transaction.xa.Xid[] recover​(int flag)  
      abstract void rollback​(javax.transaction.xa.Xid xid)  
      void run()  
      void runOnTimeout()
      Method which will run when the transaction times out
      void setTransaction​(javax.transaction.Transaction t)  
      boolean setTransactionTimeout​(int seconds)  
      void start​(javax.transaction.xa.Xid xid, int flag)  
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • module

        public static final java.lang.String module
      • trans

        protected javax.transaction.Transaction trans
      • active

        protected boolean active
      • timeout

        protected java.lang.Integer timeout
        timeout is an Integer and defaults to null so that we know if it is set on this object; if it isn't set we won't worry about the warning message, etc because we don't know what the real timeout is
      • xid

        protected javax.transaction.xa.Xid xid
    • Constructor Detail

      • GenericXaResource

        public GenericXaResource()
    • Method Detail

      • enlist

        public void enlist()
                    throws javax.transaction.xa.XAException
        Enlists this resource in the current transaction
        Throws:
        javax.transaction.xa.XAException
      • enlist

        public void enlist​(javax.transaction.Transaction tx)
                    throws javax.transaction.xa.XAException
        Enlists this resource in the current transaction
        Throws:
        javax.transaction.xa.XAException
      • start

        public void start​(javax.transaction.xa.Xid xid,
                          int flag)
                   throws javax.transaction.xa.XAException
        Specified by:
        start in interface javax.transaction.xa.XAResource
        Throws:
        javax.transaction.xa.XAException
        See Also:
        XAResource.start(javax.transaction.xa.Xid xid, int flag)
      • end

        public void end​(javax.transaction.xa.Xid xid,
                        int flag)
                 throws javax.transaction.xa.XAException
        Specified by:
        end in interface javax.transaction.xa.XAResource
        Throws:
        javax.transaction.xa.XAException
        See Also:
        XAResource.end(javax.transaction.xa.Xid xid, int flag)
      • forget

        public void forget​(javax.transaction.xa.Xid xid)
                    throws javax.transaction.xa.XAException
        Specified by:
        forget in interface javax.transaction.xa.XAResource
        Throws:
        javax.transaction.xa.XAException
        See Also:
        XAResource.forget(javax.transaction.xa.Xid xid)
      • prepare

        public int prepare​(javax.transaction.xa.Xid xid)
                    throws javax.transaction.xa.XAException
        Specified by:
        prepare in interface javax.transaction.xa.XAResource
        Throws:
        javax.transaction.xa.XAException
        See Also:
        XAResource.prepare(javax.transaction.xa.Xid xid)
      • recover

        public javax.transaction.xa.Xid[] recover​(int flag)
                                           throws javax.transaction.xa.XAException
        Specified by:
        recover in interface javax.transaction.xa.XAResource
        Throws:
        javax.transaction.xa.XAException
        See Also:
        XAResource.recover(int flag)
      • isSameRM

        public boolean isSameRM​(javax.transaction.xa.XAResource xaResource)
                         throws javax.transaction.xa.XAException
        Specified by:
        isSameRM in interface javax.transaction.xa.XAResource
        Throws:
        javax.transaction.xa.XAException
        See Also:
        XAResource.isSameRM(javax.transaction.xa.XAResource xaResource)
      • getTransactionTimeout

        public int getTransactionTimeout()
                                  throws javax.transaction.xa.XAException
        Specified by:
        getTransactionTimeout in interface javax.transaction.xa.XAResource
        Throws:
        javax.transaction.xa.XAException
        See Also:
        XAResource.getTransactionTimeout()
      • setTransactionTimeout

        public boolean setTransactionTimeout​(int seconds)
                                      throws javax.transaction.xa.XAException
        Specified by:
        setTransactionTimeout in interface javax.transaction.xa.XAResource
        Throws:
        javax.transaction.xa.XAException
        See Also:
        Note: the valus is saved but in the current implementation this is not used.
      • getTransaction

        public javax.transaction.Transaction getTransaction()
      • setTransaction

        public void setTransaction​(javax.transaction.Transaction t)
      • getXid

        public javax.transaction.xa.Xid getXid()
      • commit

        public abstract void commit​(javax.transaction.xa.Xid xid,
                                    boolean onePhase)
                             throws javax.transaction.xa.XAException
        Specified by:
        commit in interface javax.transaction.xa.XAResource
        Throws:
        javax.transaction.xa.XAException
        See Also:
        XAResource.commit(javax.transaction.xa.Xid xid, boolean onePhase)
      • rollback

        public abstract void rollback​(javax.transaction.xa.Xid xid)
                               throws javax.transaction.xa.XAException
        Specified by:
        rollback in interface javax.transaction.xa.XAResource
        Throws:
        javax.transaction.xa.XAException
        See Also:
        XAResource.rollback(javax.transaction.xa.Xid xid)
      • runOnTimeout

        public void runOnTimeout()
        Method which will run when the transaction times out
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread