|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Allows XA resources to register and unregister themselves with the Transaction Manager on startup. It also allows a transaction to be suspended and resumed.
Field Summary | |
static java.lang.String |
ASYNC_TIMEOUT_DELIST
A constant that is used as the name of the registration property that controls whether an enlisted resource is delisted by a different thread that is processing the transaction timeout prior to the timeout thread's invocation of XAResource.rollback. |
static java.lang.String |
CALL_SET_TRANSACTION_TIMEOUT
A constant that is used as the name of the registration property that controls whether the transaction manager sets the resource timeout. |
static java.lang.String |
ENLISTMENT_DYNAMIC
This enlistment mode requires the resource to dynamically enlist with the transaction manager when accessed by the application. |
static java.lang.String |
ENLISTMENT_STANDARD
Allows an application or XAResource adaptor to register a XA resource dynamically, typically before the resource is made available to the application. |
static java.lang.String |
ENLISTMENT_STATIC
Registering the XA resource statically means that the transaction service always enlists the resource when a transaction is attached to a thread. |
static java.lang.String |
ENLISTMENT_TYPE
A constant that is used as the name of the resource registration property that determines the enlistment style of the resource being registered. |
static java.lang.String |
RECOVER_RETRY_DURATION_SECONDS
A constant that is used as the name of the registration property that controls whether recover will be retried for the specified duration in seconds. |
static java.lang.String |
RECOVER_RETRY_INTERVAL_SECONDS
A constant that is used as the name of the registration property that controls the frequency in seconds at which the recover operation is performed on the resource. |
Method Summary | |
void |
begin(java.lang.String name)
Create a new transaction, set the transaction name property and associate the transaction with the current thread. |
void |
begin(java.lang.String name,
int timeoutseconds)
Create a new transaction with the specified timeout value, set the transaction name property and associate the transaction with the current thread. |
void |
forceResume(javax.transaction.Transaction suspendedTx)
If the transaction is active, resume automatically
enlists statically registered resources and associates the
transaction with the thread. |
javax.transaction.Transaction |
forceSuspend()
suspend dissociates the transaction from the thread
delists enlisted resources and marks the transaction for rollback
in the event of any failures (for example, while delisting
statically registered resources). |
javax.transaction.Transaction |
getTransaction(javax.transaction.xa.Xid xid)
Given an XID returns the corresponding transaction object, if any. |
void |
registerDynamicResource(java.lang.String name,
javax.transaction.xa.XAResource xar)
Allows an application or XAResource adaptor to register a XA resource dynamically, typically before the resource is made available to the application. |
void |
registerResource(java.lang.String name,
javax.transaction.xa.XAResource xar)
Allows an application or XAResource adaptor to register a XA resource dynamically, typically before the resource is made available to the application. |
void |
registerResource(java.lang.String name,
javax.transaction.xa.XAResource xar,
java.util.Hashtable properties)
Registers a resource under a specified name. |
void |
registerStaticResource(java.lang.String name,
javax.transaction.xa.XAResource xar)
Allows an application or XAResource adaptor to register a XA resource statically, typically before the resource is made available to the application. |
void |
unregisterResource(java.lang.String name)
unregisterResource removes a prior resource registration. |
Methods inherited from interface javax.transaction.TransactionManager |
begin,
commit,
getStatus,
getTransaction,
resume,
rollback,
setRollbackOnly,
setTransactionTimeout,
suspend |
Field Detail |
public static final java.lang.String ENLISTMENT_TYPE
registerResource(String, XAResource, Hashtable)
,
ENLISTMENT_DYNAMIC
,
ENLISTMENT_STATIC
,
ENLISTMENT_STANDARD
public static final java.lang.String ENLISTMENT_DYNAMIC
registerResource(String, XAResource, Hashtable)
,
ENLISTMENT_TYPE
public static final java.lang.String ENLISTMENT_STATIC
registerResource(String, XAResource, Hashtable)
,
ENLISTMENT_TYPE
public static final java.lang.String ENLISTMENT_STANDARD
registerResource(String, XAResource, Hashtable)
,
ENLISTMENT_TYPE
public static final java.lang.String RECOVER_RETRY_DURATION_SECONDS
public static final java.lang.String ASYNC_TIMEOUT_DELIST
registerResource(String, XAResource, Hashtable)
public static final java.lang.String CALL_SET_TRANSACTION_TIMEOUT
registerResource(String, XAResource, Hashtable)
public static final java.lang.String RECOVER_RETRY_INTERVAL_SECONDS
RECOVER_RETRY_DURATION_SECONDS
Method Detail |
public void registerStaticResource(java.lang.String name, javax.transaction.xa.XAResource xar) throws javax.transaction.SystemException
While optional, this call improves performance during an
enlistResource
operation. If an
enlistResource
call is made and the resource (or
another instance of its type) has not previously been registered,
the transaction service automatically registers the new resource
dynamically using the class name of the resource as the name. See
below for description of registering a XA resource
dynamically.
The registerStaticResource
method has the following
parameters:
name
- The name of the resource. This name is used
in error messages as well as in the branch qualifier
part of all transaction ids supplied
to the resource.xar
- A reference to a XAResource object that is
subsequently used to handle recovery. It can also
be the weblogic extension
weblogic.transaction.XAResource.public void registerDynamicResource(java.lang.String name, javax.transaction.xa.XAResource xar) throws javax.transaction.SystemException
While optional, this call improves performance during an
enlistResource
operation. If an enlistResource
call is made and the resource (or another instance of its type) has not
previously been registered, the transaction service automatically
registers the new resource dynamically using the class name of the
resource as the name. See below for description of registering a XA
resource dynamically.
The registerDynamicResource
method has the following
parameters:
name
- The name of the resource. This name is used
in error messages as well as in the branch qualifier
part of all transaction ids supplied
to the resource.xar
- A reference to a XAResource object that is
subsequently used to handle recovery. It can also
be the weblogic extension
weblogic.transaction.XAResource.public void registerResource(java.lang.String name, javax.transaction.xa.XAResource xar) throws javax.transaction.SystemException
While optional, this call improves performance during an
enlistResource
operation. If an enlistResource
call is made and the resource (or another instance of its type) has not
previously been registered, the transaction service automatically
registers the new resource dynamically using the class name of the
resource as the name. See below for description of registering a XA
resource dynamically.
The registerResource
method has the following
parameters:
name
- The name of the resource. This name is used
in error messages as well as in the branch qualifier
part of all transaction ids supplied
to the resource.xar
- A reference to a XAResource object that is
subsequently used to handle recovery. It can also
be the weblogic extension
weblogic.transaction.XAResource.public void unregisterResource(java.lang.String name) throws javax.transaction.SystemException
public javax.transaction.Transaction getTransaction(javax.transaction.xa.Xid xid)
public void forceResume(javax.transaction.Transaction suspendedTx)
resume
automatically
enlists statically registered resources and associates the
transaction with the thread. It also checks to see if there's
another transaction associated with the thread.
forceResume
simply associates a transaction with a
thread without further ado. It is used when you want to suspend a
transaction in a thread and subsequently resume it without
checking the state. This call is typically used by XA resource
providers. Caution must be exercised when using this method
because it bypasses all the sanity checks otherwise performed by
resume.
The following example illustrates its use. Say, you want to make
an RMI or JDBC call (or simply a call to a local object) without
propagating the transaction, while ensuring that code after the
RMI call sees the transaction in its original state. The
following code illustrates the use of
forceResume
:
import weblogic.transaction.TransactionManager; import weblogic.transaction.Transaction; TransactionManager tm = TxHelper.getTransaction(); Transaction saveTx = null; try { saveTx = tm.forceSuspend(); .. make non-transactional call ... } finally { tm.forceResume(saveTx); }
Weblogic rmi supports a marker interface called "NonTransactionRemote" and an rmi compiler option "-nontransactional". For those remote interfaces extending this interface (or by using the rmic command-line option) the complier inserts this boiler-plate code in the RMI stub.
public javax.transaction.Transaction forceSuspend()
suspend
dissociates the transaction from the thread
delists enlisted resources and marks the transaction for rollback
in the event of any failures (for example, while delisting
statically registered resources). forceSuspend
merely dissociates the transaction from the thread; it doesn't
delist resources, nor does it throw any exceptions.
public void begin(java.lang.String name) throws javax.transaction.NotSupportedException, javax.transaction.SystemException
name
- The descriptive name to be associated with the
new transaction.Transaction.setName(String)
public void begin(java.lang.String name, int timeoutseconds) throws javax.transaction.NotSupportedException, javax.transaction.SystemException
name
- The descriptive name to be associated with the
new transaction.timeoutseconds
- The timeout value for the transaction.
This value will override the default timeout value associated
with the current thread. If a value of zero is specified
the default timeout will be used.Transaction.setName(String)
public void registerResource(java.lang.String name, javax.transaction.xa.XAResource xar, java.util.Hashtable properties) throws javax.transaction.SystemException
name
- The name of the resource. This name is used
in error messages as well as in the branch qualifier
part of all transaction ids supplied
to the resource.xar
- A reference to a XAResource object that is
subsequently used to handle recovery. It can also
be the weblogic extension
weblogic.transaction.XAResource.properties
- Properties that control how the resource
will be controlled by the transaction manager.ENLISTMENT_TYPE
,
ENLISTMENT_DYNAMIC
,
ENLISTMENT_STATIC
,
ENLISTMENT_STANDARD
,
INTERLEAVING_ENLISTMENTS
,
CALL_SET_TRANSACTION_TIMEOUT
,
LOCAL_ASSIGNMENT_OF_REMOTE_RESOURCES
,
THREAD_AFFINITY
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs70 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |