|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
java.lang.ThreadLocal
com.tangosol.util.ThreadGate.ThreadLocalCounter
public static class ThreadGate.ThreadLocalCounter
Specialization of ThreadLocalObject that can be used for efficient thread local long counters.
This class associates a single Long value with the current thread. The Long value may be retrieved, set, removed, incremented, or decremented.
Constructor Summary | |
---|---|
ThreadGate.ThreadLocalCounter() Create a new ThreadLocalCounter with an initial Long value of zero. |
Method Summary | |
---|---|
long |
decrement() Decrement the Long value of the ThreadLocalCounter for the current thread by one. |
long |
increment() Increment the Long value of the ThreadLocalCounter for the current thread by one. |
protected java.lang.Long |
initialValue() Returns the current thread's initial value for this thread-local variable. |
Methods inherited from class java.lang.ThreadLocal |
---|
get, remove, set |
Constructor Detail |
---|
public ThreadGate.ThreadLocalCounter()
Method Detail |
---|
public long increment()
decrement()
public long decrement()
increment()
protected java.lang.Long initialValue()
ThreadLocal.get()
method. The initialValue method will not be invoked in a thread if the thread invokes the ThreadLocal.set(T)
method prior to the get method.
This implementation simply returns null; if the programmer desires thread-local variables to be initialized to some value other than null, ThreadLocal must be subclassed, and this method overridden. Typically, an anonymous inner class will be used. Typical implementations of initialValue will invoke an appropriate constructor and return the newly constructed object.
initialValue
in class java.lang.ThreadLocal
|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |