Class VolatileHolder<V>

  • Type Parameters:
    V - the value type
    All Implemented Interfaces:
    Holder<V>

    public class VolatileHolder<V>
    extends Object
    implements Holder<V>
    VolatileHolder is a basic implementation of the Holder interface where the held object is referenced from a volatile reference.
    Author:
    mf 2010.12.02
    • Field Detail

      • m_value

        protected volatile V m_value
        The held value.
    • Constructor Detail

      • VolatileHolder

        public VolatileHolder()
        Construct a VolatileHolder with no value.
      • VolatileHolder

        public VolatileHolder​(V value)
        Construct a VolatileHolder with an initial value.
        Parameters:
        value - the initial value
    • Method Detail

      • set

        public void set​(V value)
        Specify the held object.
        Specified by:
        set in interface Holder<V>
        Parameters:
        value - the object to hold
      • get

        public V get()
        Return the held object.
        Specified by:
        get in interface Holder<V>
        Returns:
        the held object