Oracle® Coherence Java API Reference
v3.5.3

E15583-01

com.tangosol.util
Class ThreadLocalObject

java.lang.Object
  extended by com.tangosol.util.Base
      extended by 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.ThreadLocal directly.

Author:
cp 1997.05.03; mf 2007.04.27

Constructor Summary
ThreadLocalObject()
          Create a ThreadLocalObject.
ThreadLocalObject(java.lang.Object object)
          Create a ThreadLocalObject with an initial value.
 
Method Summary
 void check()
          Deprecated. as of Coherence 3.3 this method is a no-op
 java.lang.Object get()
          Get the value of the ThreadLocalObject for the current thread.
 java.lang.Object getObject()
          Get the value of the ThreadLocalObject for the current thread.
 int getPruneDelay()
          Deprecated. as of Coherence 3.3 this method always returns zero.
 int getRollover()
          Deprecated. as of Coherence 3.3 this method always returns zero.
protected  java.lang.Object getValue()
          Get the value stored by this instance of ThreadLocalObject.
 void prune()
          Deprecated. as of Coherence 3.3 this method is a no-op
 void remove()
          Remove the ThreadLocalObject for the current thread.
 void set(java.lang.Object object)
          Set the value of the ThreadLocalObject for the current thread.
 void setObject(java.lang.Object object)
          Set the value of the ThreadLocalObject for the current thread.
 void setPruneDelay(int cMillisDelay)
          Deprecated. as of Coherence 3.3 this method is a no-op
 void setRollover(int cRollover)
          Deprecated. as of Coherence 3.3 this method is a no-op
protected  void setValue(java.lang.Object object)
          Set the value stored by this instance of ThreadLocalObject.
 

Constructor Detail

ThreadLocalObject

public ThreadLocalObject()
Create a ThreadLocalObject.


ThreadLocalObject

public ThreadLocalObject(java.lang.Object object)
Create a ThreadLocalObject with an initial value.

Parameters:
object - the ThreadLocalObject value for the current thread
Method Detail

get

public java.lang.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(java.lang.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 java.lang.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(java.lang.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-op

Check if pruning is necessary.


prune

public void prune()
Deprecated. as of Coherence 3.3 this method is a no-op

Prune 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-op

Set 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-op

Set the minimum number of seconds between prunings.

Parameters:
cMillisDelay - the minimum number of milliseconds to delay

getValue

protected java.lang.Object getValue()
Get the value stored by this instance of ThreadLocalObject.

Returns:
the value stored by this instance of ThreadLocalObject

setValue

protected void setValue(java.lang.Object object)
Set the value stored by this instance of ThreadLocalObject.

Parameters:
object - the new value

Oracle® Coherence Java API Reference
v3.5.3

E15583-01

Copyright © 2000, 2010, Oracle. All rights reserved.