Package 

Class SynchronizedReference

  • All Implemented Interfaces:

    
    public final class SynchronizedReference<T extends Object>
    
                        

    An object reference that may be updated thread-safely.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final T get() Provides an existing T object reference.
      final T getOrCreate(Function0<T> builder) Provides either an existing T object or creates a new one using builder function.
      final Boolean reset() Drops an existing T object reference to null.
      final T set(T value) Accepts value instance of T and holds its reference.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SynchronizedReference

        SynchronizedReference(T value)
    • Method Detail

      • get

         final T get()

        Provides an existing T object reference.

      • getOrCreate

         final T getOrCreate(Function0<T> builder)

        Provides either an existing T object or creates a new one using builder function.

        This method is thread-safe and can be safely invoked without external synchronization.

      • reset

         final Boolean reset()

        Drops an existing T object reference to null.

      • set

         final T set(T value)

        Accepts value instance of T and holds its reference.

        This method is thread-safe and can be safely invoked without external synchronization.