Package com.tangosol.util
Class ThreadLocalObject
- java.lang.Object
-
- com.tangosol.util.Base
-
- com.tangosol.util.ThreadLocalObject
-
public class ThreadLocalObject extends Base
This class provides an implementation of thread local storage.As of Coherence 3.3 this class is a wrapper around
ThreadLocal.Note: Where practical, use
java.lang.ThreadLocaldirectly.- Author:
- cp 1997.05.03; mf 2007.04.27
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Constructor Summary
Constructors Constructor Description ThreadLocalObject()Create a ThreadLocalObject.ThreadLocalObject(Object object)Create a ThreadLocalObject with an initial value.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcheck()Deprecated.as of Coherence 3.3 this method is a no-opObjectget()Get the value of the ThreadLocalObject for the current thread.ObjectgetObject()Get the value of the ThreadLocalObject for the current thread.intgetPruneDelay()Deprecated.as of Coherence 3.3 this method always returns zero.intgetRollover()Deprecated.as of Coherence 3.3 this method always returns zero.protected ObjectgetValue()Get the value stored by this instance of ThreadLocalObject.voidprune()Deprecated.as of Coherence 3.3 this method is a no-opvoidremove()Remove the ThreadLocalObject for the current thread.voidset(Object object)Set the value of the ThreadLocalObject for the current thread.voidsetObject(Object object)Set the value of the ThreadLocalObject for the current thread.voidsetPruneDelay(int cMillisDelay)Deprecated.as of Coherence 3.3 this method is a no-opvoidsetRollover(int cRollover)Deprecated.as of Coherence 3.3 this method is a no-opprotected voidsetValue(Object object)Set the value stored by this instance of ThreadLocalObject.-
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, newHashMap, newHashMap, newHashSet, newHashSet, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
-
-
-
Constructor Detail
-
ThreadLocalObject
public ThreadLocalObject()
Create a ThreadLocalObject.
-
ThreadLocalObject
public ThreadLocalObject(Object object)
Create a ThreadLocalObject with an initial value.- Parameters:
object- the ThreadLocalObject value for the current thread
-
-
Method Detail
-
get
public Object get()
Get the value of the ThreadLocalObject for the current thread.- Returns:
- the value for the current thread
- See Also:
set(Object)
-
set
public void set(Object object)
Set the value of the ThreadLocalObject for the current thread.- Parameters:
object- the value for the current thread- See Also:
get()
-
remove
public void remove()
Remove the ThreadLocalObject for the current thread.Note: On 1.4.x JVMs this method will not free any storage but will reset the value to the initial value.
-
getObject
public Object getObject()
Get the value of the ThreadLocalObject for the current thread.- Returns:
- the value for the current thread
- See Also:
setObject(Object)
-
setObject
public void setObject(Object object)
Set the value of the ThreadLocalObject for the current thread.- Parameters:
object- the value for the current thread- See Also:
getObject()
-
check
public void check()
Deprecated.as of Coherence 3.3 this method is a no-opCheck if pruning is necessary.
-
prune
public void prune()
Deprecated.as of Coherence 3.3 this method is a no-opPrune the list of dead threads.
-
getRollover
public int getRollover()
Deprecated.as of Coherence 3.3 this method always returns zero.Get the number of sets/removes necessary before a rollover occurs.- Returns:
- the rollover value
-
setRollover
public void setRollover(int cRollover)
Deprecated.as of Coherence 3.3 this method is a no-opSet the number of sets/removes necessary before a rollover occurs.- Parameters:
cRollover- the rollover value
-
getPruneDelay
public int getPruneDelay()
Deprecated.as of Coherence 3.3 this method always returns zero.Get the minimum number of seconds between prunings.- Returns:
- the minimum number of milliseconds to delay
-
setPruneDelay
public void setPruneDelay(int cMillisDelay)
Deprecated.as of Coherence 3.3 this method is a no-opSet the minimum number of seconds between prunings.- Parameters:
cMillisDelay- the minimum number of milliseconds to delay
-
getValue
protected Object getValue()
Get the value stored by this instance of ThreadLocalObject.- Returns:
- the value stored by this instance of ThreadLocalObject
-
setValue
protected void setValue(Object object)
Set the value stored by this instance of ThreadLocalObject.- Parameters:
object- the new value
-
-