Interface OffHeapConcurrentMap.EntryListener

Enclosing class:
OffHeapConcurrentMap

public static interface OffHeapConcurrentMap.EntryListener
Listener interface that is notified when certain operations occur for various memory addresses. Note that when this listener is used certain operations are not performed and require the listener to do these instead. Please note each method documentation to tell what those are.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    entryCreated(long newAddress)
    Invoked when an entry is about to be created.
    void
    entryRemoved(long removedAddress)
    Invoked when an entry is about to be removed.
    void
    entryReplaced(long newAddress, long oldAddress)
    Invoked when an entry is about to be replaced with a new one.
    void
    entryRetrieved(long entryAddress)
    Invoked when an entry is successfully retrieved.
    boolean
    resize(int pointerCount)
    Invoked when a resize event occurs.
  • Method Details

    • resize

      boolean resize(int pointerCount)
      Invoked when a resize event occurs. This will be invoked up to two times: once for the new container with a positive count and a possibly a second time for the now old container with a negative count. Note that the pointers are in a single contiguous block. It is possible to prevent the resize by returning false from the invocation.
      Parameters:
      pointerCount - the change in pointers
      Returns:
      whether the resize should continue
    • entryCreated

      void entryCreated(long newAddress)
      Invoked when an entry is about to be created. The new address is fully addressable, The write lock will already be acquired for the given segment the key mapped to.
      Parameters:
      newAddress - the address just created that will be the new entry
    • entryRemoved

      void entryRemoved(long removedAddress)
      Invoked when an entry is about to be removed. You can read values from this but after this method is completed this memory address may be freed. The write lock will already be acquired for the given segment the key mapped to.
      Parameters:
      removedAddress - the address about to be removed
    • entryReplaced

      void entryReplaced(long newAddress, long oldAddress)
      Invoked when an entry is about to be replaced with a new one. The old and new address are both addressable, however oldAddress may be freed after this method returns. The write lock will already be acquired for the given segment the key mapped to.
      Parameters:
      newAddress - the address just created that will be the new entry
      oldAddress - the old address for this entry that will be soon removed
    • entryRetrieved

      void entryRetrieved(long entryAddress)
      Invoked when an entry is successfully retrieved. The read lock will already be acquired for the given segment the key mapped to.
      Parameters:
      entryAddress - the address of the entry retrieved