Interface AccessMode


  • public interface AccessMode
    Defines the access mode of a context local storage.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static AccessMode CONCURRENT
      This access mode provides concurrent access to context local storage with thread safety and atomicity.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Object get​(Object[] locals, int idx)
      Return the object at index idx in the locals array.
      Object getOrCreate​(Object[] locals, int idx, java.util.function.Supplier<Object> initialValueSupplier)
      Get or create the object at index index in the locals array.
      void put​(Object[] locals, int idx, Object value)
      Put value in the locals array at index idx
    • Field Detail

      • CONCURRENT

        static final AccessMode CONCURRENT
        This access mode provides concurrent access to context local storage with thread safety and atomicity.
    • Method Detail

      • get

        Object get​(Object[] locals,
                   int idx)
        Return the object at index idx in the locals array.
        Parameters:
        locals - the array
        idx - the index
        Returns:
        the object at index
      • put

        void put​(Object[] locals,
                 int idx,
                 Object value)
        Put value in the locals array at index idx
        Parameters:
        locals - the array
        idx - the index
        value - the value
      • getOrCreate

        Object getOrCreate​(Object[] locals,
                           int idx,
                           java.util.function.Supplier<Object> initialValueSupplier)
        Get or create the object at index index in the locals array. When the object does not exist, initialValueSupplier must be called to obtain this value.
        Parameters:
        locals - the array
        idx - the index
        initialValueSupplier - the supplier of the initial value