tyrex.tm.impl
Class ThreadContext

java.lang.Object
  extended bytyrex.tm.RuntimeContext
      extended bytyrex.tm.impl.ThreadContext

public class ThreadContext
extends RuntimeContext

Implementation of RuntimeContext.

Version:
$Revision: 1.10 $ $Date: 2001/10/05 22:15:34 $
Author:
Assaf Arkin

Field Summary
protected  TransactionImpl _tx
          The transaction associated with this thread, if the thread is in a transaction, or null if the thread is not in a transaction.
protected  tyrex.tm.impl.ThreadContext.InternalXAResourceHolder _xaResourceHolder
          The XA resources and callbacks that have been opened before or during the transaction and must be enlisted with the transaction when the transaction starts.
 
Constructor Summary
ThreadContext(javax.naming.Context context, javax.security.auth.Subject subject)
           
ThreadContext(javax.security.auth.Subject subject)
           
 
Method Summary
protected  void add(javax.transaction.xa.XAResource xaResource, XAResourceCallback callback)
          Adds an XA resource to the association list.
 void cleanup()
          Cleanup the runtime context and discard all resources associated with it.
static void cleanup(java.lang.Thread thread)
          Called to destroy all association with a thread.
 javax.naming.Context getEnvContext()
          Returns the JNDI environment context associated with this runtime context.
 MemoryBinding getMemoryBinding()
           
 javax.security.auth.Subject getSubject()
          Returns the security subject associated with this runtime context.
static ThreadContext getThreadContext()
           
static ThreadContext getThreadContext(java.lang.Thread thread)
           
 javax.transaction.Transaction getTransaction()
          Returns the transaction associated with this runtime context.
protected  XAResourceHolder[] getXAResourceHolders()
          Returns all the XA resources, or null if no resources are enlisted.
protected  boolean remove(javax.transaction.xa.XAResource xaResource)
          Removes an XA resource from the associated list.
static void setThreadContext(ThreadContext context)
           
static ThreadContext unsetThreadContext()
           
 
Methods inherited from class tyrex.tm.RuntimeContext
getRuntimeContext, newEnvContext, newRuntimeContext, newRuntimeContext, setRuntimeContext, unsetRuntimeContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_tx

protected TransactionImpl _tx
The transaction associated with this thread, if the thread is in a transaction, or null if the thread is not in a transaction.


_xaResourceHolder

protected tyrex.tm.impl.ThreadContext.InternalXAResourceHolder _xaResourceHolder
The XA resources and callbacks that have been opened before or during the transaction and must be enlisted with the transaction when the transaction starts. Allows null entries, but no duplicates. May be null.

Constructor Detail

ThreadContext

public ThreadContext(javax.security.auth.Subject subject)

ThreadContext

public ThreadContext(javax.naming.Context context,
                     javax.security.auth.Subject subject)
              throws javax.naming.NamingException
Method Detail

getThreadContext

public static ThreadContext getThreadContext()

getThreadContext

public static ThreadContext getThreadContext(java.lang.Thread thread)

setThreadContext

public static void setThreadContext(ThreadContext context)

unsetThreadContext

public static ThreadContext unsetThreadContext()

cleanup

public static void cleanup(java.lang.Thread thread)
Description copied from class: RuntimeContext
Called to destroy all association with a thread. This method is called when the thread is no longer used.


getEnvContext

public javax.naming.Context getEnvContext()
Description copied from class: RuntimeContext
Returns the JNDI environment context associated with this runtime context.

The returned context is read-write and can be populated with objects available from the JNDI environment context when this runtime context is associated with the current thread.

Specified by:
getEnvContext in class RuntimeContext
Returns:
The JNDI environment context

getTransaction

public javax.transaction.Transaction getTransaction()
Description copied from class: RuntimeContext
Returns the transaction associated with this runtime context.

If the runtime context is associated with any open transaction, the transaction will be returned. When the runtime context is associated with the current thread, this method will return the same transaction as TransactionManager#getTransaction.

Specified by:
getTransaction in class RuntimeContext
Returns:
The transaction, or null

getSubject

public javax.security.auth.Subject getSubject()
Description copied from class: RuntimeContext
Returns the security subject associated with this runtime context.

This security subject is used for authentication and authorization.

Specified by:
getSubject in class RuntimeContext
Returns:
The security subject, or null

cleanup

public void cleanup()
Description copied from class: RuntimeContext
Cleanup the runtime context and discard all resources associated with it.

This method is called when it has been determined that this runtime context will no longer be used.

Specified by:
cleanup in class RuntimeContext

getMemoryBinding

public MemoryBinding getMemoryBinding()

add

protected void add(javax.transaction.xa.XAResource xaResource,
                   XAResourceCallback callback)
Adds an XA resource to the association list.


remove

protected boolean remove(javax.transaction.xa.XAResource xaResource)
Removes an XA resource from the associated list.

Parameters:
xaResource - the XA resource
Returns:
True if removed

getXAResourceHolders

protected XAResourceHolder[] getXAResourceHolders()
Returns all the XA resources, or null if no resources are enlisted.

Returns:
All XA resources, or null


Original code is Copyright (c) 1999-2001, Intalio, Inc. All Rights Reserved. Contributions by MetaBoss team are Copyright (c) 2003-2005, Softaris Pty. Ltd. All Rights Reserved.