com.novell.nds.dirxml.driver
Class ThreadGroupLocal

java.lang.Object
  extended by com.novell.nds.dirxml.driver.ThreadGroupLocal

public abstract class ThreadGroupLocal
extends Object

Class implementing ThreadGroup local storage. Associates variables with all threads in a ThreadGroup.


Method Summary
static void cleanup()
          Cleanup all storage associated with the effective ThreadGroup's ThreadGroupLocal storage.
static Object get(Object key)
          Get the value for the key for the current ThreadGroup
static ThreadGroup getThreadProxyGroup()
          Get this thread's proxy group.
static Object put(Object key, Object value)
          Set the key value pair for the current ThreadGroup
static Object remove(Object key)
          Remove the key and associated value for the specified ThreadGroup
static void removeAll()
          Remove all keys and associated value for the current ThreadGroup
static ThreadGroup setThreadProxyGroup(ThreadGroup proxy)
          Set this thread's proxy group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getThreadProxyGroup

public static ThreadGroup getThreadProxyGroup()
Get this thread's proxy group.

Returns:
the ThreadGroup to use as proxy
See Also:
setThreadProxyGroup(java.lang.ThreadGroup)

setThreadProxyGroup

public static ThreadGroup setThreadProxyGroup(ThreadGroup proxy)
Set this thread's proxy group. A thread's proxy group is a ThreadGroup that is used for getting and setting variables as if the thread were a member of the proxy ThreadGroup.

A proxy ThreadGroup is useful if your code is called on a thread over which you have no control (and may not have been created in the same ThreadGroup as other threads that need to put and get shared variables.

To use a proxy group, do the following:
...
ThreadGroup oldProxy = ThreadGroupLocal.setThreadProxyGroup(proxyGroup);
...
//get variable values using ThreadGroupLocal.get()
...
ThreadGroupLocal.setThreadProxyGroup(oldProxy);
...

Note that the DirXML Subscriber and Publisher threads are members of the same ThreadGroup.

Parameters:
proxy - The ThreadGroup to use instead of the current Thread's actual ThreadGroup
Returns:
the previous proxy

put

public static Object put(Object key,
                         Object value)
Set the key value pair for the current ThreadGroup

Parameters:
key -
value -
Returns:
the previous value for the key if any, null otherwise

get

public static Object get(Object key)
Get the value for the key for the current ThreadGroup

Parameters:
key -
Returns:
the value for the key if any, null otherwise

remove

public static Object remove(Object key)
Remove the key and associated value for the specified ThreadGroup

Parameters:
key -
Returns:
the previous value for the key if any, null otherwise

removeAll

public static void removeAll()
Remove all keys and associated value for the current ThreadGroup


cleanup

public static void cleanup()
Cleanup all storage associated with the effective ThreadGroup's ThreadGroupLocal storage. This has the side-effect of clearing the current thread proxy group.