org.hornetq.jms.server.recovery
Class HornetQXAResourceWrapper

java.lang.Object
  extended by org.hornetq.jms.server.recovery.HornetQXAResourceWrapper
All Implemented Interfaces:
XAResource, SessionFailureListener, org.hornetq.core.remoting.FailureListener

public class HornetQXAResourceWrapper
extends Object
implements XAResource, SessionFailureListener

XAResourceWrapper. Mainly from org.jboss.server.XAResourceWrapper from the JBoss AS server module The reason why we don't use that class directly is that it assumes on failure of connection the RM_FAIL or RM_ERR is thrown, but in HornetQ we throw XA_RETRY since we want the recovery manager to be able to retry on failure without having to manually retry

Version:
$Revision: 45341 $
Author:
Adrian Brock, Tim Fox/a>, Jeff Mesnil, Andy Taylor

Field Summary
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
HornetQXAResourceWrapper(XARecoveryConfig... xaRecoveryConfigs)
           
 
Method Summary
 void beforeReconnect(HornetQException me)
           
protected  XAException check(XAException e)
          Check whether an XAException is fatal.
 void close()
          Close the connection
 void commit(Xid xid, boolean onePhase)
           
protected  XAResource connect()
          Connect to the server if not already done so
 void connectionFailed(HornetQException me, boolean failedOver)
           
 void end(Xid xid, int flags)
           
protected  void finalize()
           
 void forget(Xid xid)
           
 int getTransactionTimeout()
           
 boolean isSameRM(XAResource xaRes)
           
 int prepare(Xid xid)
           
 Xid[] recover(int flag)
           
 void rollback(Xid xid)
           
 boolean setTransactionTimeout(int seconds)
           
 void start(Xid xid, int flags)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HornetQXAResourceWrapper

public HornetQXAResourceWrapper(XARecoveryConfig... xaRecoveryConfigs)
Method Detail

recover

public Xid[] recover(int flag)
              throws XAException
Specified by:
recover in interface XAResource
Throws:
XAException

commit

public void commit(Xid xid,
                   boolean onePhase)
            throws XAException
Specified by:
commit in interface XAResource
Throws:
XAException

rollback

public void rollback(Xid xid)
              throws XAException
Specified by:
rollback in interface XAResource
Throws:
XAException

forget

public void forget(Xid xid)
            throws XAException
Specified by:
forget in interface XAResource
Throws:
XAException

isSameRM

public boolean isSameRM(XAResource xaRes)
                 throws XAException
Specified by:
isSameRM in interface XAResource
Throws:
XAException

prepare

public int prepare(Xid xid)
            throws XAException
Specified by:
prepare in interface XAResource
Throws:
XAException

start

public void start(Xid xid,
                  int flags)
           throws XAException
Specified by:
start in interface XAResource
Throws:
XAException

end

public void end(Xid xid,
                int flags)
         throws XAException
Specified by:
end in interface XAResource
Throws:
XAException

getTransactionTimeout

public int getTransactionTimeout()
                          throws XAException
Specified by:
getTransactionTimeout in interface XAResource
Throws:
XAException

setTransactionTimeout

public boolean setTransactionTimeout(int seconds)
                              throws XAException
Specified by:
setTransactionTimeout in interface XAResource
Throws:
XAException

connectionFailed

public void connectionFailed(HornetQException me,
                             boolean failedOver)
Specified by:
connectionFailed in interface org.hornetq.core.remoting.FailureListener

beforeReconnect

public void beforeReconnect(HornetQException me)
Specified by:
beforeReconnect in interface SessionFailureListener

connect

protected XAResource connect()
                      throws Exception
Connect to the server if not already done so

Returns:
the connectionFactory XAResource
Throws:
Exception - for any problem

toString

public String toString()
Overrides:
toString in class Object

close

public void close()
Close the connection


check

protected XAException check(XAException e)
                     throws XAException
Check whether an XAException is fatal. If it is an RM problem we close the connection so the next call will reconnect.

Parameters:
e - the xa exception
Returns:
never
Throws:
XAException - always

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable


Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.