|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.atomikos.datasource.xa.XATransactionalResource
public abstract class XATransactionalResource
Copyright © 2001-2004, Atomikos. All rights reserved. An abstract XA implementation of a transactional resource. For a particular XA data source, it is necessary to implement the refreshXAConnection method, because in general there is no standard way of getting XAResource instances. Therefore, this class is agnostic about it.
| Field Summary | |
|---|---|
protected Hashtable |
recoveryMap_
|
protected String |
servername_
|
protected Hashtable |
siblingmappers_
|
protected XAResource |
xares_
|
protected XidFactory |
xidFact_
|
| Constructor Summary | |
|---|---|
XATransactionalResource(String servername)
Construct a new instance with a default XidFactory. |
|
XATransactionalResource(String servername,
XidFactory factory)
Construct a new instance with a custom XidFactory. |
|
| Method Summary | |
|---|---|
boolean |
acceptsAllXAResources()
|
void |
close()
The default close operation. |
protected Xid |
createXid(String tid)
Create an XID for the given tx. |
void |
endRecovery()
Notify the resource that recovery is ended. |
String |
getName()
Get the name of the resource. |
ResourceTransaction |
getResourceTransaction(CompositeTransaction ct)
Get or create a ResourceTransaction. |
XAResource |
getXAResource()
Get the XAResource instance that this instance is using. |
XidFactory |
getXidFactory()
Get the xidFactory for this instance. |
boolean |
isClosed()
Test if the resource is closed. |
boolean |
isSameRM(RecoverableResource res)
Test if a resource is the same as another one. |
protected boolean |
needsRefresh()
Check if the XAResource needs to be refreshed. |
protected void |
printMsg(String msg,
int level)
|
protected void |
recover()
Recover the contained XAResource, and retrieve the xid instances that start with our server's name. |
boolean |
recover(Participant participant)
Recover the partially reconstructed Participant. |
protected abstract XAResource |
refreshXAConnection()
Utility method to establish and refresh the XAResource. |
void |
setAcceptAllXAResources(boolean val)
Specify whether to entirely shortcut the isSameRM method of the XAResource implementations, and always return true for usesXAResource. |
void |
setRecoveryService(RecoveryService recoveryService)
Initialize this resource with the recovery service. |
void |
setXidFactory(XidFactory factory)
Set the XID factory, needed for online management tools. |
boolean |
usesWeakCompare()
Test if this instance uses weak compare mode. |
boolean |
usesXAResource(XAResource xares)
Test if the XAResource is used by this instance. |
void |
useWeakCompare(boolean weakCompare)
Set this instance to use the weak compare mode setting. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected XAResource xares_
protected String servername_
protected Hashtable recoveryMap_
protected Hashtable siblingmappers_
protected XidFactory xidFact_
| Constructor Detail |
|---|
public XATransactionalResource(String servername)
servername - The servername, needed to identify the xid instances for the
current configuration. Max BYTE length is 64!
public XATransactionalResource(String servername,
XidFactory factory)
servername - The servername, needed to identify the xid instances for the
current configuration. Max BYTE length is 64!factory - The custom XidFactory.| Method Detail |
|---|
protected abstract XAResource refreshXAConnection()
throws ResourceException
ResourceException - On failure.public XidFactory getXidFactory()
protected void printMsg(String msg,
int level)
protected boolean needsRefresh()
public void useWeakCompare(boolean weakCompare)
IllegalStateException - If recovery was already done, meaning that the transaction
service is already running.public boolean usesWeakCompare()
public void setAcceptAllXAResources(boolean val)
val - public boolean acceptsAllXAResources()
public boolean usesXAResource(XAResource xares)
xares - The XAResource to test.
public XAResource getXAResource()
public ResourceTransaction getResourceTransaction(CompositeTransaction ct)
throws ResourceException,
IllegalStateException
TransactionalResource
getResourceTransaction in interface TransactionalResourcect - The composite transaction for whom this is done.
This serves as a handle for the resource to determine isolation
properties, coordinator reference and so on.
For instance, XA implementations can use the isSameTransaction()
function to determine if an existing XID should be used to
start the internal XAResource before passing it on as a
ResourceTransaction (wrapped) instance.
ResourceException - On failure.
IllegalStateException - If the given transaction is no longer
active.TransactionalResourcepublic String getName()
RecoverableResource
getName in interface RecoverableResourceTransactionalResource
public void close()
throws ResourceException
close in interface RecoverableResourceResourceException
public boolean isClosed()
throws ResourceException
isClosed in interface RecoverableResourceResourceException
public boolean isSameRM(RecoverableResource res)
throws ResourceException
RecoverableResource
isSameRM in interface RecoverableResourceResourceExceptionRecoverableResource
public void setRecoveryService(RecoveryService recoveryService)
throws ResourceException
RecoverableResource
setRecoveryService in interface RecoverableResourcerecoveryService - The recovery service. This instance
can be used by the resource to ask recovery from the
transaction engine.
ResourceException - On errors.RecoverableResource
public boolean recover(Participant participant)
throws ResourceException
RecoverableResource
recover in interface RecoverableResourceparticipant - A partially recovered Participant.
ResourceException - On failure.TransactionalResource
protected void recover()
throws ResourceException
ResourceException - If a failure occurs.
public void endRecovery()
throws ResourceException
RecoverableResource
endRecovery in interface RecoverableResourceResourceException - On failure.TransactionalResource.public void setXidFactory(XidFactory factory)
factory - protected Xid createXid(String tid)
tid - The tx id.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||