Class 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 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-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 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