Class AbstractMapInterceptor
java.lang.Object
com.loomcache.server.datastructures.AbstractMapInterceptor
- All Implemented Interfaces:
MapInterceptor
No-op adapter for
MapInterceptor.
Subclass this and override only the hooks you need. All default implementations pass through without modification:
interceptGet(String, String)returns the original keyinterceptGetResult(String, String, String)returns the original valueinterceptPut(String, String, String)returns the original key-value pairafterPut(String, String, String, String)is a no-opinterceptRemove(String, String)returnstrue(proceed)afterRemove(String, String, String)is a no-op
- Since:
- 1.1
- See Also:
-
Constructor Summary
Constructors -
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.
-
Constructor Details
-
AbstractMapInterceptor
public AbstractMapInterceptor()
-
-
Method Details
-
interceptGet
Description copied from interface:MapInterceptorCalled before a get operation. May modify the lookup key.- Specified by:
interceptGetin interfaceMapInterceptor- Parameters:
mapName- the name of the distributed mapkey- the original lookup key- Returns:
- the (possibly modified) key to use for the get; must not be null
-
interceptGetResult
Description copied from interface:MapInterceptorCalled after a get operation completes. May modify the returned value.- Specified by:
interceptGetResultin interfaceMapInterceptor- 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
Description copied from interface:MapInterceptorCalled before a put operation. May modify the key/value pair or cancel the put entirely.- Specified by:
interceptPutin interfaceMapInterceptor- 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
Description copied from interface:MapInterceptorCalled after a put operation completes successfully.- Specified by:
afterPutin interfaceMapInterceptor- 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
Description copied from interface:MapInterceptorCalled before a remove operation. Returnfalseto cancel the remove.- Specified by:
interceptRemovein interfaceMapInterceptor- Parameters:
mapName- the name of the distributed mapkey- the key to be removed- Returns:
trueto proceed with the remove,falseto cancel it
-
afterRemove
Description copied from interface:MapInterceptorCalled after a remove operation completes (only when an entry was actually removed).- Specified by:
afterRemovein interfaceMapInterceptor- 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
-