com.sun.genericra.inbound
Class SimpleXAResourceProxy

java.lang.Object
  extended by com.sun.genericra.AbstractXAResourceType
      extended by com.sun.genericra.inbound.SimpleXAResourceProxy
All Implemented Interfaces:
XAResourceType, javax.transaction.xa.XAResource

public class SimpleXAResourceProxy
extends AbstractXAResourceType

XAResource wrapper for Generic JMS Connector. This class intercepts all calls to the actual XAResource object of the physical JMS connection and performs corresponding book-keeping tasks in the ManagedConnection representing the physical connection.


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
SimpleXAResourceProxy(javax.transaction.xa.XAResource xar)
          Constructor for XAResourceImpl
 
Method Summary
 void commit(javax.transaction.xa.Xid xid, boolean onePhase)
          Commit the global transaction specified by xid.
 void end(javax.transaction.xa.Xid xid, int flags)
          Ends the work performed on behalf of a transaction branch.
 void forget(javax.transaction.xa.Xid xid)
          Tell the resource manager to forget about a heuristically completed transaction branch.
 int getTransactionTimeout()
          Obtain the current transaction timeout value set for this XAResource instance.
 java.lang.Object getWrappedObject()
          Abstract method declaration.
 boolean isSameRM(javax.transaction.xa.XAResource xares)
          This method is called to determine if the resource manager instance represented by the target object is the same as the resouce manager instance represented by the parameter xares.
 int prepare(javax.transaction.xa.Xid xid)
          Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.
 javax.transaction.xa.Xid[] recover(int flag)
          Obtain a list of prepared transaction branches from a resource manager.
 void rollback(javax.transaction.xa.Xid xid)
          Inform the resource manager to roll back work done on behalf of a transaction branch
 boolean setTransactionTimeout(int seconds)
          Set the current transaction timeout value for this XAResource instance.
 void start(javax.transaction.xa.Xid xid, int flags)
          Start work on behalf of a transaction branch specified in xid.
 
Methods inherited from class com.sun.genericra.AbstractXAResourceType
compare, getConnection, getRMPolicy, setConnection, setRMPolicy
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleXAResourceProxy

public SimpleXAResourceProxy(javax.transaction.xa.XAResource xar)
Constructor for XAResourceImpl

Parameters:
xar - XAResource
mc - ManagedConnection
Method Detail

commit

public void commit(javax.transaction.xa.Xid xid,
                   boolean onePhase)
            throws javax.transaction.xa.XAException
Commit the global transaction specified by xid.

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

end

public void end(javax.transaction.xa.Xid xid,
                int flags)
         throws javax.transaction.xa.XAException
Ends the work performed on behalf of a transaction branch.

Parameters:
xid - A global transaction identifier that is the same as what was used previously in the start method.
flags - One of TMSUCCESS, TMFAIL, or TMSUSPEND
Throws:
javax.transaction.xa.XAException

forget

public void forget(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Tell the resource manager to forget about a heuristically completed transaction branch.

Parameters:
xid - A global transaction identifier
Throws:
javax.transaction.xa.XAException

getTransactionTimeout

public int getTransactionTimeout()
                          throws javax.transaction.xa.XAException
Obtain the current transaction timeout value set for this XAResource instance.

Returns:
the transaction timeout value in seconds
Throws:
javax.transaction.xa.XAException

isSameRM

public boolean isSameRM(javax.transaction.xa.XAResource xares)
                 throws javax.transaction.xa.XAException
This method is called to determine if the resource manager instance represented by the target object is the same as the resouce manager instance represented by the parameter xares.

Parameters:
xares - An XAResource object whose resource manager instance is to be compared with the resource
Returns:
true if it's the same RM instance; otherwise false.
Throws:
javax.transaction.xa.XAException

prepare

public int prepare(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.

Parameters:
xid - A global transaction identifier
Returns:
A value indicating the resource manager's vote on the outcome of the transaction. The possible values are: XA_RDONLY or XA_OK. If the resource manager wants to roll back the transaction, it should do so by raising an appropriate XAException in the prepare method.
Throws:
javax.transaction.xa.XAException

recover

public javax.transaction.xa.Xid[] recover(int flag)
                                   throws javax.transaction.xa.XAException
Obtain a list of prepared transaction branches from a resource manager.

Parameters:
flag - One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must be used when no other flags are set in flags.
Returns:
The resource manager returns zero or more XIDs for the transaction branches that are currently in a prepared or heuristically completed state. If an error occurs during the operation, the resource manager should throw the appropriate XAException.
Throws:
javax.transaction.xa.XAException

rollback

public void rollback(javax.transaction.xa.Xid xid)
              throws javax.transaction.xa.XAException
Inform the resource manager to roll back work done on behalf of a transaction branch

Parameters:
xid - A global transaction identifier
Throws:
javax.transaction.xa.XAException

setTransactionTimeout

public boolean setTransactionTimeout(int seconds)
                              throws javax.transaction.xa.XAException
Set the current transaction timeout value for this XAResource instance.

Parameters:
seconds - the transaction timeout value in seconds.
Returns:
true if transaction timeout value is set successfully; otherwise false.
Throws:
javax.transaction.xa.XAException

start

public void start(javax.transaction.xa.Xid xid,
                  int flags)
           throws javax.transaction.xa.XAException
Start work on behalf of a transaction branch specified in xid.

Parameters:
xid - A global transaction identifier to be associated with the resource
Throws:
javax.transaction.xa.XAException

getWrappedObject

public java.lang.Object getWrappedObject()
Description copied from class: AbstractXAResourceType
Abstract method declaration.

Specified by:
getWrappedObject in interface XAResourceType
Specified by:
getWrappedObject in class AbstractXAResourceType