Interface MapInterceptor

All Known Implementing Classes:
AbstractMapInterceptor

public interface MapInterceptor
Synchronous interceptor for DistributedMap operations.

Interceptors execute in registration order before and after each core operation (get, put, remove). Pre-interceptors can modify keys/values or cancel operations; post-interceptors observe results.

Implementations must be thread-safe: multiple operations may invoke interceptor methods concurrently.

If a pre-interceptor throws, the operation is aborted and the failure is propagated as an InterceptorExecutionException. Post-operation hooks are best-effort and may be logged and ignored.

Since:
1.1
See Also:
  • Method Details

    • interceptGet

      String interceptGet(String mapName, String key)
      Called before a get operation. May modify the lookup key.
      Parameters:
      mapName - the name of the distributed map
      key - the original lookup key
      Returns:
      the (possibly modified) key to use for the get; must not be null
    • interceptGetResult

      @Nullable String interceptGetResult(String mapName, String key, @Nullable String value)
      Called after a get operation completes. May modify the returned value.
      Parameters:
      mapName - the name of the distributed map
      key - the key that was looked up
      value - the value retrieved from the store, or null if absent
      Returns:
      the (possibly modified) value to return to the caller
    • interceptPut

      @Nullable Map.Entry<String,String> interceptPut(String mapName, String key, String value)
      Called before a put operation. May modify the key/value pair or cancel the put entirely.
      Parameters:
      mapName - the name of the distributed map
      key - the original key
      value - the original value
      Returns:
      the (possibly modified) key-value pair; return null to cancel the put
    • afterPut

      void afterPut(String mapName, String key, String value, @Nullable String oldValue)
      Called after a put operation completes successfully.
      Parameters:
      mapName - the name of the distributed map
      key - the key that was stored
      value - the value that was stored
      oldValue - the previous value, or null if the key was new
    • interceptRemove

      boolean interceptRemove(String mapName, String key)
      Called before a remove operation. Return false to cancel the remove.
      Parameters:
      mapName - the name of the distributed map
      key - the key to be removed
      Returns:
      true to proceed with the remove, false to cancel it
    • afterRemove

      void afterRemove(String mapName, String key, @Nullable String oldValue)
      Called after a remove operation completes (only when an entry was actually removed).
      Parameters:
      mapName - the name of the distributed map
      key - the key that was removed
      oldValue - the value that was removed, or null if the key was not present