public class ServiceEvents
extends java.lang.Object
Cache
instances.Modifier and Type | Method and Description |
---|---|
static <K,V,P,R> void |
setCacheEntryMethodInvocationHandler(Cache<K,V> cache,
java.lang.String handlerName,
CacheEntryMethodInvocationHandler<K,V,P,R> eventHandler,
ParamHolder<P> paramHolder)
Set a
CacheEntryMethodInvocationHandler for the target cache. |
static <K,V,R> void |
setCacheEntryMethodInvocationHandler(Cache<K,V> cache,
java.lang.String handlerName,
CacheEntryMethodInvocationHandler<K,V,java.lang.Void,R> eventHandler)
Set a
CacheEntryMethodInvocationHandler for the target cache. |
static <K,V> void |
setEraseObjectHandler(Cache<K,V> cache,
CacheEntryEraseHandler<K,V> eraseHandler)
Sets a
CacheEntryEraseHandler for the target cache. |
static <K,V> void |
setEventDeliveryExceptionHandler(Cache<K,V> cache,
EventDeliveryExceptionHandler<K,V> exceptionHandler)
Set an event delivery exception handler.
|
static <K,V> void |
setExpirationHandler(Cache<K,V> cache,
CacheEntryExpirationHandler<K,V> listener)
Sets a
CacheEntryExpirationHandler for the target Cache . |
static <K,V,P> void |
setForEachEventHandler(Cache<K,V> cache,
java.lang.String handlerName,
CacheEntryForEachHandler<K,V,P> eventHandler,
ParamHolder<P> paramHolder)
Sets a
CacheEntryForEachHandler and ParamHolder for the target cache. |
static <K,V> void |
setForEachEventHandler(Cache<K,V> cache,
java.lang.String handlerName,
CacheEntryForEachHandler<K,V,java.lang.Void> eventHandler)
Sets a
CacheEntryForEachHandler for the target cache. |
static <K,V> void |
setLoadObjectHandler(Cache<K,V> cache,
ValueFactory<K,V> valueFactory)
Sets a
ValueFactory for loading objects into the target Cache . |
static <K,V> void |
setPostedEventHandler(Cache<K,V> cache,
PostedEventHandler<K> messageHandler)
Set a
PostedEventHandler for the target cache. |
static <K,V,P,R> void |
setReduceEventHandler(Cache<K,V> cache,
java.lang.String handlerName,
CacheEntryReduceHandler<K,V,P,R> eventHandler,
ParamHolder<P> paramHolder)
Sets a
CacheEntryReduceHandler and ParamHolder for the target cache. |
static <K,V,R> void |
setReduceEventHandler(Cache<K,V> cache,
java.lang.String handlerName,
CacheEntryReduceHandler<K,V,java.lang.Void,R> eventHandler)
Sets a
CacheEntryReduceHandler for the target cache. |
static <K,V> void |
setStoreObjectHandler(Cache<K,V> cache,
CacheEntryStoreHandler<K,V> storeHandler)
Sets a
CacheEntryStoreHandler for the target cache. |
public static <K,V> void setExpirationHandler(Cache<K,V> cache, CacheEntryExpirationHandler<K,V> listener) throws ServiceEventsException
CacheEntryExpirationHandler
for the target Cache
.K
- the key type.V
- the value type.cache
- the target cache.listener
- the expiration listener.ServiceEventsException
- if an exception occurs while setting the expiration listener.public static <K,V> void setLoadObjectHandler(Cache<K,V> cache, ValueFactory<K,V> valueFactory) throws ServiceEventsException
ValueFactory
for loading objects into the target Cache
.K
- the key type.V
- the value type.cache
- the target cache.valueFactory
- the value factory callback.ServiceEventsException
- if an exception occurs while setting the value factory.public static <K,V> void setStoreObjectHandler(Cache<K,V> cache, CacheEntryStoreHandler<K,V> storeHandler) throws ServiceEventsException
CacheEntryStoreHandler
for the target cache.K
- the key type.V
- the value type.cache
- the target cache.storeHandler
- the store handler callback.ServiceEventsException
- if an exception occurs while setting the store handler.public static <K,V> void setEraseObjectHandler(Cache<K,V> cache, CacheEntryEraseHandler<K,V> eraseHandler) throws ServiceEventsException
CacheEntryEraseHandler
for the target cache.K
- the key type.V
- the value type.cache
- the target cache.eraseHandler
- the eraseHandler callback.ServiceEventsException
- if an exception occurs while setting the eraseHandler.public static <K,V> void setPostedEventHandler(Cache<K,V> cache, PostedEventHandler<K> messageHandler) throws ServiceEventsException
PostedEventHandler
for the target cache.K
- the cache key type.V
- the cache value type.cache
- the cache to listen for posted events.messageHandler
- the posted event handler.ServiceEventsException
- if an exception occurs while registering for events.public static <K,V> void setForEachEventHandler(Cache<K,V> cache, java.lang.String handlerName, CacheEntryForEachHandler<K,V,java.lang.Void> eventHandler) throws ServiceEventsException
CacheEntryForEachHandler
for the target cache.K
- the key type.V
- the value type.cache
- the cache to listen for foreach events.handlerName
- the name of this handler. Used when calling Cache.invoke(String, Duration)
eventHandler
- the foreach event handler.ServiceEventsException
- if an exception occurs while registering for events.public static <K,V,P> void setForEachEventHandler(Cache<K,V> cache, java.lang.String handlerName, CacheEntryForEachHandler<K,V,P> eventHandler, ParamHolder<P> paramHolder) throws ServiceEventsException
CacheEntryForEachHandler
and ParamHolder
for the target cache.K
- the key type.V
- the value type.P
- the parameter object type.cache
- the cache to listen for foreach events.handlerName
- the name of this handler. Used when calling Cache.invoke(String, Duration)
eventHandler
- the foreach event handler.paramHolder
- the param holder.ServiceEventsException
- if an exception occurs while registering for events.public static <K,V,R> void setReduceEventHandler(Cache<K,V> cache, java.lang.String handlerName, CacheEntryReduceHandler<K,V,java.lang.Void,R> eventHandler) throws ServiceEventsException
CacheEntryReduceHandler
for the target cache.K
- the key type.V
- the value type.R
- the result type.cache
- the cache to listen for reduce events.handlerName
- the handler name. Used by Cache.invoke(String, Duration)
eventHandler
- the reduce event handler.ServiceEventsException
- if an exception occurs while registering for events.public static <K,V,P,R> void setReduceEventHandler(Cache<K,V> cache, java.lang.String handlerName, CacheEntryReduceHandler<K,V,P,R> eventHandler, ParamHolder<P> paramHolder) throws ServiceEventsException
CacheEntryReduceHandler
and ParamHolder
for the target cache.K
- the key type.V
- the value type.P
- Void
R
- the result type.cache
- the cache to listen for reduce events.handlerName
- the handler name. Used by Cache.invoke(String, Duration)
paramHolder
- the param holder.eventHandler
- the reduce event handler.ServiceEventsException
- if an exception occurs while registering for events.public static <K,V,R> void setCacheEntryMethodInvocationHandler(Cache<K,V> cache, java.lang.String handlerName, CacheEntryMethodInvocationHandler<K,V,java.lang.Void,R> eventHandler) throws ServiceEventsException
CacheEntryMethodInvocationHandler
for the target cache.K
- the key type.V
- the value type.R
- the result type.cache
- the cache to listen for reduce events.handlerName
- the name of the cache entry handler.eventHandler
- the cache entry method invocation handler.ServiceEventsException
- if an exception occurs while registering for events.public static <K,V,P,R> void setCacheEntryMethodInvocationHandler(Cache<K,V> cache, java.lang.String handlerName, CacheEntryMethodInvocationHandler<K,V,P,R> eventHandler, ParamHolder<P> paramHolder) throws ServiceEventsException
CacheEntryMethodInvocationHandler
for the target cache.K
- the key type.V
- the value type.P
- the param type.R
- the result type.cache
- the cache to listen for reduce events.handlerName
- the name of the cache entry handler.eventHandler
- the cache entry method invocation handler.paramHolder
- the param holder.ServiceEventsException
- if an exception occurs while registering for events.public static <K,V> void setEventDeliveryExceptionHandler(Cache<K,V> cache, EventDeliveryExceptionHandler<K,V> exceptionHandler) throws ServiceEventsException
If an unhandled exception occurs during event processing, the exception will be passed to the EventDeliveryExceptionHandler
.
*note* Exceptions occurring during Cache.postEvent(Object, String, byte[], Duration)
, Cache.postEvent(Object, String, String, byte[], Duration)
,
Cache.invoke(String, String, Duration)
, Cache.invoke(String, byte[], Duration)
, Cache.invoke(String, Duration)
,
Cache.invoke(String, String, byte[], Duration)
, Cache.singleInvoke(Object, String, Duration)
,
Cache.singleInvoke(Object, String, String, Duration)
, Cache.singleInvoke(Object, String, Duration)
,
and Cache.singleInvoke(Object, String, String, byte[], Duration)
operations will still fail with the result type
RequestStatus.UnhandledExceptionInCallback
. The exceptions stack trace will be returned as a UTF-8 encoded byte[] from InvokeResponse.getErrorData()
K
- the key type.V
- the value type.cache
- the cache where an event delivery exception may occur.exceptionHandler
- the exception handler.ServiceEventsException
- if an exception occurs while registering for events.