BEA Systems, Inc.

WebLogic Server 8.1 API Reference

weblogic.transaction
Interface TransactionManager

All Known Subinterfaces:
ServerTransactionManager

public interface TransactionManager
extends ClientTransactionManager

Allows XA resources to register and unregister themselves with the Transaction Manager on startup. It also allows a transaction to be suspended and resumed.

Author:
Copyright © 2004 BEA Systems, Inc. All Rights Reserved.

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 INTERLEAVING_ENLISTMENTS
          A constant that is used as the name of the registration property that controls interleaving enlistments.
static java.lang.String LOCAL_ASSIGNMENT_OF_REMOTE_RESOURCES
          A constant that is used as the name of the registration property that controls how participating resources are assigned to servers.
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.
static java.lang.String THREAD_AFFINITY
          A constant that is used as the name of the registration property that controls whether an enlisted resource needs thread affinity.
 
Method Summary
 void begin(int timeoutseconds)
          Create a new transaction with the specified timeout value, and associate the transaction with the current thread.
 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.
 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, NonXAResource nxar)
          Register the NonXAResource with the transaction manager.
 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 weblogic.transaction.ClientTransactionManager
forceResume, forceSuspend
 
Methods inherited from interface javax.transaction.TransactionManager
begin, commit, getStatus, getTransaction, resume, rollback, setRollbackOnly, setTransactionTimeout, suspend
 

Field Detail

ENLISTMENT_TYPE

public static final 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.
See Also:
registerResource(String, XAResource, Hashtable), ENLISTMENT_DYNAMIC, ENLISTMENT_STATIC, ENLISTMENT_STANDARD

ENLISTMENT_DYNAMIC

public static final java.lang.String ENLISTMENT_DYNAMIC
This enlistment mode requires the resource to dynamically enlist with the transaction manager when accessed by the application.
See Also:
registerResource(String, XAResource, Hashtable), ENLISTMENT_TYPE

ENLISTMENT_STATIC

public static final 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. In other words, the resource is not expected to enlist itself when used. It is important to emphasize the fact that once a resource is registered statically, it gets automatically enlisted in every transaction.
See Also:
registerResource(String, XAResource, Hashtable), ENLISTMENT_TYPE

ENLISTMENT_STANDARD

public static final 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. The resource should enlist itself once with the transaction that it participates in. The Transaction Manager will perform subsequent re-enlistment of the resource in the transaction if necessary. Delistment is optional.
See Also:
registerResource(String, XAResource, Hashtable), ENLISTMENT_TYPE

INTERLEAVING_ENLISTMENTS

public static final java.lang.String INTERLEAVING_ENLISTMENTS
A constant that is used as the name of the registration property that controls interleaving enlistments. When set to false, only a single thread will be allowed to be enlisted with a particular XAResource instance at any given time. Other threads attempting to enlist with an XAResource instance that is already enlisted will be blocked until the other application thread delists the resource from its transaction. The default value is true.
See Also:
registerResource(String, XAResource, Hashtable)

CALL_SET_TRANSACTION_TIMEOUT

public static final 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. When set to true, the transaction manager will call XAResource.setTransactionTimeout for each resource enlistment with a value approximately equal to that of the global transaction timeout. The default value is false.
See Also:
registerResource(String, XAResource, Hashtable)

LOCAL_ASSIGNMENT_OF_REMOTE_RESOURCES

public static final java.lang.String LOCAL_ASSIGNMENT_OF_REMOTE_RESOURCES
A constant that is used as the name of the registration property that controls how participating resources are assigned to servers. When set to true, a resource enlisted in the transaction on a non-coordinating server will be assigned to the coordinating server to perform XAResource operation if that resource is registered on the coordinating server. Setting this option to false will cause the transaction manager to always assign resources to a server where the resource was enlisted. The default value is true.
See Also:
registerResource(String, XAResource, Hashtable)

ASYNC_TIMEOUT_DELIST

public static final 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.
See Also:
registerResource(String, XAResource, Hashtable)

THREAD_AFFINITY

public static final java.lang.String THREAD_AFFINITY
A constant that is used as the name of the registration property that controls whether an enlisted resource needs thread affinity. i.e, XA.start and XA.end should happen on the same thread.
See Also:
registerResource(String, XAResource, Hashtable)

RECOVER_RETRY_DURATION_SECONDS

public static final 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. The default value is 0.

RECOVER_RETRY_INTERVAL_SECONDS

public static final 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. The default value is 30. Setting this registration option has no effect unless there is a positive value assigned for the RECOVER_RETRY_DURATION_SECONDS registration option.
See Also:
RECOVER_RETRY_DURATION_SECONDS
Method Detail

registerStaticResource

public void registerStaticResource(java.lang.String name,
                                   javax.transaction.xa.XAResource xar)
                            throws javax.transaction.SystemException
Allows an application or XAResource adaptor to register a XA resource statically, typically before the resource is made available to the application. Registering the XA resource statically means that the transaction service always enlists the resource when a transaction is attached to a thread. In other words, the resource is not expected to enlist itself when used. It is important to emphasize the fact that once a resource is registered statically, it gets automatically enlisted in every transaction.

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:

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.


registerDynamicResource

public void registerDynamicResource(java.lang.String name,
                                    javax.transaction.xa.XAResource xar)
                             throws javax.transaction.SystemException
Allows an application or XAResource adaptor to register a XA resource dynamically, typically before the resource is made available to the application. Registering the XA resource dynamically means that the transaction service does not enlist the resource at all. In other words, the resource is expected to enlist itself before every usage appropriately.

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:

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.


registerResource

public void registerResource(java.lang.String name,
                             javax.transaction.xa.XAResource xar)
                      throws javax.transaction.SystemException
Allows an application or XAResource adaptor to register a XA resource dynamically, typically before the resource is made available to the application. The resource should enlist itself once with the transaction that it participates in. The Transaction Manager will perform subsequent re-enlistment of the resource in the transaction if necessary. Delistment is optional.

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:

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.


unregisterResource

public void unregisterResource(java.lang.String name)
                        throws javax.transaction.SystemException
unregisterResource removes a prior resource registration. It is typically called when a system administrator decides not to host a resource on a particular server.


getTransaction

public javax.transaction.Transaction getTransaction(javax.transaction.xa.Xid xid)
Given an XID returns the corresponding transaction object, if any.


begin

public void begin(java.lang.String name)
           throws javax.transaction.NotSupportedException,
                  javax.transaction.SystemException
Create a new transaction, set the transaction name property and associate the transaction with the current thread.

Parameters:
name - The descriptive name to be associated with the new transaction.
Throws:
javax.transaction.NotSupportedException - Thrown if the thread is already associated with a transaction.
javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.
See Also:
Transaction.setName(String)

begin

public void begin(int timeoutseconds)
           throws javax.transaction.NotSupportedException,
                  javax.transaction.SystemException
Create a new transaction with the specified timeout value, and associate the transaction with the current thread.

Parameters:
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.
Throws:
javax.transaction.NotSupportedException - Thrown if the thread is already associated with a transaction.
javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.
See Also:
TransactionManager.setTransactionTimeout(int)

begin

public void begin(java.lang.String name,
                  int timeoutseconds)
           throws javax.transaction.NotSupportedException,
                  javax.transaction.SystemException
Create a new transaction with the specified timeout value, set the transaction name property and associate the transaction with the current thread.

Parameters:
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.
Throws:
javax.transaction.NotSupportedException - Thrown if the thread is already associated with a transaction.
javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.
See Also:
Transaction.setName(String)

registerDynamicResource

public void registerDynamicResource(java.lang.String name,
                                    NonXAResource nxar)
                             throws javax.transaction.SystemException
Register the NonXAResource with the transaction manager.


registerResource

public void registerResource(java.lang.String name,
                             javax.transaction.xa.XAResource xar,
                             java.util.Hashtable properties)
                      throws javax.transaction.SystemException
Registers a resource under a specified name. The enlistment type and other behavioral options for the resource may be specified.

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.

properties - Properties that control how the resource will be controlled by the transaction manager.
See Also:
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://e-docs.bea.com/wls/docs81