Interface AccessMode


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

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

    Modifier and Type
    Method
    Description
    get(Object[] locals, int idx)
    Return the object at index idx in the locals array.
    getOrCreate(Object[] locals, int idx, 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 Details

    • CONCURRENT

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

    • 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, 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