org.jboss.jms.server.recovery
Class MessagingXAResourceWrapper

java.lang.Object
  extended by org.jboss.jms.server.recovery.MessagingXAResourceWrapper
All Implemented Interfaces:
javax.transaction.xa.XAResource

public class MessagingXAResourceWrapper
extends java.lang.Object
implements javax.transaction.xa.XAResource

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 JBM 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>

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
MessagingXAResourceWrapper(java.lang.String providerName, java.lang.String username, java.lang.String password)
           
 
Method Summary
protected  javax.transaction.xa.XAException check(javax.transaction.xa.XAException e)
          Check whether an XAException is fatal.
 void close()
          Close the connection
 void commit(javax.transaction.xa.Xid xid, boolean onePhase)
           
protected  javax.transaction.xa.XAResource connect()
          Connect to the server if not already done so
 void end(javax.transaction.xa.Xid xid, int flags)
           
protected  void finalize()
           
 void forget(javax.transaction.xa.Xid xid)
           
protected  XAConnectionFactory getConnectionFactory()
          Get the XAConnectionFactory
 javax.transaction.xa.XAResource getDelegate()
          Get the delegate XAResource
 java.lang.String getProviderName()
          Get the providerName.
 int getTransactionTimeout()
           
 boolean isSameRM(javax.transaction.xa.XAResource xaRes)
           
 void onException(JMSException exception)
           
 int prepare(javax.transaction.xa.Xid xid)
           
 javax.transaction.xa.Xid[] recover(int flag)
           
 void rollback(javax.transaction.xa.Xid xid)
           
 void setProviderName(java.lang.String providerName)
          Set the providerName.
 boolean setTransactionTimeout(int seconds)
           
 void start(javax.transaction.xa.Xid xid, int flags)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessagingXAResourceWrapper

public MessagingXAResourceWrapper(java.lang.String providerName,
                                  java.lang.String username,
                                  java.lang.String password)
Method Detail

getProviderName

public java.lang.String getProviderName()
Get the providerName.

Returns:
the providerName.

setProviderName

public void setProviderName(java.lang.String providerName)
Set the providerName.

Parameters:
providerName - the providerName.

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

commit

public 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

rollback

public 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

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

isSameRM

public boolean isSameRM(javax.transaction.xa.XAResource xaRes)
                 throws javax.transaction.xa.XAException
Specified by:
isSameRM in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

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

start

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

end

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

getTransactionTimeout

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

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

onException

public void onException(JMSException exception)

getDelegate

public javax.transaction.xa.XAResource getDelegate()
                                            throws javax.transaction.xa.XAException
Get the delegate XAResource

Returns:
the delegate
Throws:
javax.transaction.xa.XAException - for any problem

connect

protected javax.transaction.xa.XAResource connect()
                                           throws java.lang.Exception
Connect to the server if not already done so

Returns:
the delegate XAResource
Throws:
java.lang.Exception - for any problem

getConnectionFactory

protected XAConnectionFactory getConnectionFactory()
                                            throws java.lang.Exception
Get the XAConnectionFactory

Returns:
the connection
Throws:
java.lang.Exception - for any problem

close

public void close()
Close the connection


check

protected javax.transaction.xa.XAException check(javax.transaction.xa.XAException e)
                                          throws javax.transaction.xa.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:
javax.transaction.xa.XAException - always

finalize

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


Copyright © 2006 JBoss Inc. All Rights Reserved.