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 Summary
Modifier and TypeMethodDescriptionvoidCalled after a put operation completes successfully.voidafterRemove(String mapName, String key, @Nullable String oldValue) Called after a remove operation completes (only when an entry was actually removed).interceptGet(String mapName, String key) Called before a get operation.@Nullable StringinterceptGetResult(String mapName, String key, @Nullable String value) Called after a get operation completes.interceptPut(String mapName, String key, String value) Called before a put operation.booleaninterceptRemove(String mapName, String key) Called before a remove operation.
-
Method Details
-
interceptGet
-
interceptGetResult
Called after a get operation completes. May modify the returned value.- Parameters:
mapName- the name of the distributed mapkey- the key that was looked upvalue- the value retrieved from the store, or null if absent- Returns:
- the (possibly modified) value to return to the caller
-
interceptPut
Called before a put operation. May modify the key/value pair or cancel the put entirely.- Parameters:
mapName- the name of the distributed mapkey- the original keyvalue- the original value- Returns:
- the (possibly modified) key-value pair; return
nullto cancel the put
-
afterPut
Called after a put operation completes successfully.- Parameters:
mapName- the name of the distributed mapkey- the key that was storedvalue- the value that was storedoldValue- the previous value, or null if the key was new
-
interceptRemove
-
afterRemove
Called after a remove operation completes (only when an entry was actually removed).- Parameters:
mapName- the name of the distributed mapkey- the key that was removedoldValue- the value that was removed, or null if the key was not present
-