com.atomikos.datasource.xa
Class AcceptAllXATransactionalResource

java.lang.Object
  extended by com.atomikos.datasource.xa.XATransactionalResource
      extended by com.atomikos.datasource.xa.AcceptAllXATransactionalResource
All Implemented Interfaces:
RecoverableResource, TransactionalResource

public class AcceptAllXATransactionalResource
extends XATransactionalResource

This class is useful only for enlist via the JTA API. In particular, this class is a 'workaround' for buggy XAResource implementations where isSameRM returns false even if it should not. With the default automatic resource registration mode, this situation would lead to another XATransactionalResource being added to the configuration for each such enlist. As an alternative, this class pretends to recognize any XAResource and can be used to avoid problems when automatic registration is disabled: instead of reporting errors claiming that the XAResource is unknown for fault isSameRM cases, this class will silently accept them.


Field Summary
 
Fields inherited from class com.atomikos.datasource.xa.XATransactionalResource
recoveryMap_, servername_, siblingmappers_, xares_, xidFact_
 
Constructor Summary
AcceptAllXATransactionalResource(String servername)
           
AcceptAllXATransactionalResource(String servername, XidFactory factory)
           
 
Method Summary
 void endRecovery()
          Notify the resource that recovery is ended.
protected  void recover()
          Recover the contained XAResource, and retrieve the xid instances that start with our server's name.
protected  XAResource refreshXAConnection()
          Utility method to establish and refresh the XAResource.
 boolean usesXAResource(XAResource res)
          Always returns true.
 
Methods inherited from class com.atomikos.datasource.xa.XATransactionalResource
acceptsAllXAResources, close, createXid, getName, getResourceTransaction, getXAResource, getXidFactory, isClosed, isSameRM, needsRefresh, printMsg, recover, setAcceptAllXAResources, setRecoveryService, setXidFactory, usesWeakCompare, useWeakCompare
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AcceptAllXATransactionalResource

public AcceptAllXATransactionalResource(String servername)
Parameters:
servername -

AcceptAllXATransactionalResource

public AcceptAllXATransactionalResource(String servername,
                                        XidFactory factory)
Parameters:
servername -
factory -
Method Detail

refreshXAConnection

protected XAResource refreshXAConnection()
                                  throws ResourceException
Description copied from class: XATransactionalResource
Utility method to establish and refresh the XAResource. An XAResource is actually a connection to a back-end resource, and this connection needs to stay open for the transactional resource instance. The resource uses the XAResource regularly, but sometimes the back-end server can close the connection after a time-out. At intialization time and also after such a time-out, this method is called to refresh the XAResource instance. This is typically done by (re-)establishing a connection to the server and keeping this connection open!.

Specified by:
refreshXAConnection in class XATransactionalResource
Returns:
XAResource A XAResource instance that will be used to represent the server.
Throws:
ResourceException - On failure.
See Also:
XATransactionalResource.refreshXAConnection()

usesXAResource

public boolean usesXAResource(XAResource res)
Always returns true.

Overrides:
usesXAResource in class XATransactionalResource
Parameters:
res - The XAResource to test.
Returns:
boolean True iff this instance uses the same back-end resource, in as far as this can be determined by this instance.

recover

protected void recover()
Description copied from class: XATransactionalResource
Recover the contained XAResource, and retrieve the xid instances that start with our server's name.

Overrides:
recover in class XATransactionalResource

endRecovery

public void endRecovery()
Description copied from interface: RecoverableResource
Notify the resource that recovery is ended. Called by TM at end of recovery; any remaining resourcetransactions (i.e., that have not been associated with any recover call) should be rolled back. This is because if the were not recovered by the TM, then surely they are not supposed to be indoubt (the TM recovers ALL indoubt work!) and should be rolled back.

Specified by:
endRecovery in interface RecoverableResource
Overrides:
endRecovery in class XATransactionalResource
See Also:
TransactionalResource.


Copyright © 2011. All Rights Reserved.