1 Reply Latest reply on Feb 4, 2009 9:07 AM by Andy Taylor

    caching xa resource on the client side.

    Andy Taylor Master

      This is regarding https://jira.jboss.org/jira/browse/JBMESSAGING-1298

      Currently we make all calls as blocking when we wouldn't need to if we cached some of the state on the client side. I've gone through the methods to see which ones we can make non blocking as follows:


      void commit(javax.transaction.xa.Xid xid, boolean b)

      void rollback(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException;

      int prepare(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException;

      for obvoius reasons all these need to be blocking.

      int getTransactionTimeout() throws javax.transaction.xa.XAException;

      needs to be blocking as we return the timeout.

      javax.transaction.xa.Xid[] recover(int i) throws javax.transaction.xa.XAException;

      again we're returning values so needs to be blocking

      non blocking

      void start(javax.transaction.xa.Xid xid, int i) throws javax.transaction.xa.XAException;

      this can be non blocking. It never throws an exception and it doesn't matter what flags are passed.

      void end(javax.transaction.xa.Xid xid, int i) throws javax.transaction.xa.XAException;

      If the xid passed in is *not* the xid of the tx currently associated with the session then we need to do this non blocking as we need to throw an exception if it doesn't exist or is not suspended.

      If the xid is the xid of the currently associated tx and is being called with success or fail flags then we only throw an exception if the tx is in a suspended state. Since we can check this state on the client side we can do this non blocking. If the suspend flag is passed then again we only throw an exception if the tx is already suspended which again we can check on the cliet side.

      void forget(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException;

      currently forget doesn't actually do anything apart from set the state so this can be non blocking.

      boolean setTransactionTimeout(int i) throws javax.transaction.xa.XAException;

      this always returns false so can be done non blocking.

      boolean isSameRM(javax.transaction.xa.XAResource xaResource) throws javax.transaction.xa.XAException;

      this is already client side.

      Code change will basically just holding state on the client side and moving some of the error handling to the client.