io.vertx.core.spi.context.storage

## Interface AccessMode

-     public interface AccessMode

  Defines the access mode of a context local storage.

- - ### Field Summary

    Fields
    Modifier and Type | Field and 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 and Description
    --- | ---
    `Object` | `get(AtomicReferenceArray<Object> locals, int idx)` Return the object at index `idx` in the `locals` array.
    `Object` | `getOrCreate(AtomicReferenceArray<Object> locals, int idx, java.util.function.Supplier<Object> initialValueSupplier)` Get or create the object at index `index` in the `locals` array.
    `void` | `put(AtomicReferenceArray<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(AtomicReferenceArray<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(AtomicReferenceArray<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(AtomicReferenceArray<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

Copyright © 2025 Eclipse. All rights reserved.