org.openorb.ots.Impl

Class Current

public class Current extends LocalObject implements Current, LogEnabled

This is the current interface implementation.

Author: Jerome Daniel Alex Andrushchak

Constructor Summary
Current(ORBInitInfo info, int t_slot)
Constructor
Method Summary
voidapplyXAConnection(PropagationContext pctx)
This operation is used to add XA connection during a transaction.
voidbegin()
A new transaction is created.
voidcloseXAConnection(XAConnection xa_connection, boolean success)
This operation is used when an XA connection is closed.
voidcommit(boolean report_heuristics)
If there is no transaction associated with the client thread, the NoTransaction exception is raised.
voidenableLogging(Logger logger)
PropagationContextgetPropagationContext()
This operation is used to return the propagation context
static VectorgetXA()
Controlget_control()
If the client thread is not associated with a transaction, a null object reference is returned.
Statusget_status()
If there is no transaction associated with the client thread, the StatusNoTransaction value is returned.
Stringget_transaction_name()
If there is no transaction associated with the client thread, an empty string is returned.
voidpop_txcontext()
This operation restores a previously saved propagation context.
voidpush_txcontext(PropagationContext pctx)
This operation is used to push a propagation context in a stack.
voidregisterXAConnection(XAConnection xa_connection)
This operation is used to register an XA connection.
voidregisterXAResource(XAResource resource, PropagationContext pctx)
Register an XA Resource.
voidresume(Control which)
If the parameter is a null object reference, the client thread becomes associated with no transaction.
voidrollback()
If there is no transaction associated with the client thread, the NoTransaction exception is raised.
voidrollback_only()
If there is no transaction associated with the client thread, the NoTransaction exception is raised.
voidset_timeout(int seconds)
This operation modifies a state variable associated with the target object that affects the time-out period associated with top-level transactions created by subsequent invocations of the begin operation.
Controlsuspend()
If the client thread is not associated with a transaction, a null object reference is returned.
voidunregisterXACoordinator(XACoordinator xacoord)
When a transaction is finished ( committed or rolledback ), the XA coordinator must be unregistered from the POA.

Constructor Detail

Current

public Current(ORBInitInfo info, int t_slot)
Constructor

Method Detail

applyXAConnection

public void applyXAConnection(PropagationContext pctx)
This operation is used to add XA connection during a transaction.

begin

public void begin()
A new transaction is created. The transaction context of the client thread is modified so that the thread is associated with the new transaction. If the client thread is currently associated with a transaction, the new transaction is a subtransaction of that transaction. Otherwise, the new transaction is a top-level transaction.

Throws: org.omg.CosTransactions.SubtransactionsUnavailable The SubtransactionsUnavailable exception is raised if the client thread already has an associated transaction and the Transaction Service implementation does not support nested transactions.

closeXAConnection

public void closeXAConnection(XAConnection xa_connection, boolean success)
This operation is used when an XA connection is closed.

commit

public void commit(boolean report_heuristics)
If there is no transaction associated with the client thread, the NoTransaction exception is raised. If the client thread does not have permission to commit the transaction, the standard exception NO_PERMISSION is raised. (The commit operation may be restricted to the transaction originator in some implementations.) Otherwise, the transaction associated with the client thread is completed. The effect of this request is equivalent to performing the commit operation on the corresponding Terminator object. The client thread transaction context is modified as follows: If the transaction was begun by a thread (invoking begin) in the same execution environment, then the threads transaction context is restored to its state prior to the begin request. Otherwise, the threads transaction context is set to null.

enableLogging

public void enableLogging(Logger logger)

getPropagationContext

public PropagationContext getPropagationContext()
This operation is used to return the propagation context

getXA

public static Vector getXA()

get_control

public Control get_control()
If the client thread is not associated with a transaction, a null object reference is returned. Otherwise, a Control object is returned that represents the transaction context currently associated with the client thread. This object can be given to the resume operation to reestablish this context in the same thread or a different thread. The scope within which this object is valid is implementation dependent; at a minimum, it must be usable by the client thread. This operation is not dependent on the state of the transaction; in particular, it does not raise the TRANSACTION_ROLLEDBACK exception.

get_status

public Status get_status()
If there is no transaction associated with the client thread, the StatusNoTransaction value is returned. Otherwise, this operation returns the status of the transaction associated with the client thread. The effect of this request is equivalent to performing the get_status operation on the corresponding Coordinator object.

get_transaction_name

public String get_transaction_name()
If there is no transaction associated with the client thread, an empty string is returned. Otherwise, this operation returns a printable string describing the transaction. The returned string is intended to support debugging. The effect of this request is equivalent to performing the get_transaction_name operation on the corresponding Coordinator object.

pop_txcontext

public void pop_txcontext()
This operation restores a previously saved propagation context. For example, when a sub transaction is completed, the parent propagation context is restored.

push_txcontext

public void push_txcontext(PropagationContext pctx)
This operation is used to push a propagation context in a stack. When a sub transaction begins, the parent propagation context must be stored in a stack.

registerXAConnection

public void registerXAConnection(XAConnection xa_connection)
This operation is used to register an XA connection. This XA connection is added because no transaction is begun.

registerXAResource

public void registerXAResource(XAResource resource, PropagationContext pctx)
Register an XA Resource.

resume

public void resume(Control which)
If the parameter is a null object reference, the client thread becomes associated with no transaction. Otherwise, if the parameter is valid in the current execution environment, the client thread becomes associated with that transaction (in place of any previous transaction). Otherwise, the InvalidControl exception is raised. This operation is not dependent on the state of the transaction; in particular, it does not raise the TRANSACTION_ROLLEDBACK exception.

rollback

public void rollback()
If there is no transaction associated with the client thread, the NoTransaction exception is raised. If the client thread does not have permission to rollback the transaction, the standard exception NO_PERMISSION is raised. (The rollback operation may be restricted to the transaction originator in some implementations; however, the rollback_only operation, described below, is available to all transaction participants.) Otherwise, the transaction associated with the client thread is rolled back. The effect of this request is equivalent to performing the rollback operation on the corresponding Terminator object. The client thread transaction context is modified as follows: If the transaction was begun by a thread (invoking begin) in the same execution environment, then the thread?s transaction context is restored to its state prior to the begin request. Otherwise, the thread?s transaction context is set to null.

rollback_only

public void rollback_only()
If there is no transaction associated with the client thread, the NoTransaction exception is raised. Otherwise, the transaction associated with the client thread is modified so that the only possible outcome is to rollback the transaction. The effect of this request is equivalent to performing the rollback_only operation on the corresponding Coordinator object.

set_timeout

public void set_timeout(int seconds)
This operation modifies a state variable associated with the target object that affects the time-out period associated with top-level transactions created by subsequent invocations of the begin operation. If the parameter has a nonzero value n, then top-level transactions created by subsequent invocations of begin will be subject to being rolled back if they do not complete before n seconds after their creation. If the parameter is zero, then no application specified time-out is established.

suspend

public Control suspend()
If the client thread is not associated with a transaction, a null object reference is returned. Otherwise, an object is returned that represents the transaction context currently associated with the client thread. This object can be given to the resume operation to reestablish this context in the same thread or a different thread. The scope within which this object is valid is implementation dependent; at a minimum, it must be usable by the client thread. In addition, the client thread becomes associated with no transaction. This operation is not dependent on the state of the transaction; in particular, it does not raise the TRANSACTION_ROLLEDBACK exception.

unregisterXACoordinator

public void unregisterXACoordinator(XACoordinator xacoord)
When a transaction is finished ( committed or rolledback ), the XA coordinator must be unregistered from the POA.