org.eclipse.ohf.ihe.common.atna
Class ConfigurableInheritableThreadLocal

java.lang.Object
  extended by java.lang.ThreadLocal
      extended by java.lang.InheritableThreadLocal
          extended by org.eclipse.ohf.ihe.common.atna.ConfigurableInheritableThreadLocal

public class ConfigurableInheritableThreadLocal
extends java.lang.InheritableThreadLocal

An extension of the InheritableThreadLocal class which permits switching between use of thread local variable behaviour, and traditional static value. This allows applications which do not need thread local variables, to avoid the performance penalty which comes from using InheritableThreadLocal.

Since:
OHF 1.0.0
Author:
Glenn Deen glenn@almaden.ibm.com

Constructor Summary
ConfigurableInheritableThreadLocal()
           
 
Method Summary
static void enableThreading(boolean enable)
          Set true to enable the class to use InheritableThreadLocal variables.
 java.lang.Object get()
           
static boolean isThreadingEnabled()
          Tests if thread local variables are in use or not.
 void set(java.lang.Object value)
           
 
Methods inherited from class java.lang.ThreadLocal
remove
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurableInheritableThreadLocal

public ConfigurableInheritableThreadLocal()
Method Detail

enableThreading

public static void enableThreading(boolean enable)
Set true to enable the class to use InheritableThreadLocal variables. This can be done at any time, as the previous static value used in single thread mode, will be the initial value used by threads until they set it to a new value.

Parameters:
enable - true to enable, false to use a single static variable for the value

isThreadingEnabled

public static boolean isThreadingEnabled()
Tests if thread local variables are in use or not.

Returns:

get

public final java.lang.Object get()
Overrides:
get in class java.lang.ThreadLocal

set

public final void set(java.lang.Object value)
Overrides:
set in class java.lang.ThreadLocal