Package com.tangosol.net.events
Class NamedEventInterceptor<E extends Event<?>>
java.lang.Object
com.tangosol.net.events.NamedEventInterceptor<E>
- Type Parameters:
E
- the type of event
- All Implemented Interfaces:
EventDispatcherAwareInterceptor<E>
,EventInterceptor<E>
public class NamedEventInterceptor<E extends Event<?>>
extends Object
implements EventDispatcherAwareInterceptor<E>
A wrapper for
EventInterceptor
s allowing additional metadata to be
associated with the interceptor without augmenting the interceptor contract.
This implementation will derive defaults for the values it is concerned
with. These defaults are based on the presence of the Interceptor
annotation, one or more Events
annotations, or a generic type
defined on the EventInterceptor class file. Once this class has been
initialized, via constructors, it is immutable.
There may be circumstances when the cost of deriving defaults may not be
required thus a constructor
is provided that avoids this initialization.
- Since:
- Coherence 12.1.2
- Author:
- hr/nsa/bo 2011.03.29
-
Constructor Summary
ConstructorDescriptionNamedEventInterceptor
(EventInterceptor<E> interceptor) Construct a NamedEventInterceptor for the specified interceptor.NamedEventInterceptor
(EventInterceptor<E> interceptor, NamedEventInterceptor<E> incptrNamed) Construct a NamedEventInterceptor for the specified interceptor using the provided NamedEventInterceptor as the source to clone from.NamedEventInterceptor
(String sName, EventInterceptor<E> interceptor) Construct a NamedEventInterceptor for the specified interceptor and unique identifier.NamedEventInterceptor
(String sName, EventInterceptor<E> interceptor, RegistrationBehavior behavior) Construct a NamedEventInterceptor for the specified interceptor and unique identifier.NamedEventInterceptor
(String sName, EventInterceptor<E> interceptor, String sCacheName, String sServiceName, Interceptor.Order order, RegistrationBehavior behavior) Construct a NamedEventInterceptor for the specified interceptor.NamedEventInterceptor
(String sName, EventInterceptor<E> interceptor, String sCacheName, String sServiceName, Interceptor.Order order, RegistrationBehavior behavior, Set<Enum> setEventTypes) Construct a NamedEventInterceptor for the specified interceptor. -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
Based on the state of the NamedEventInterceptor populate any uninitialized values based on either an annotation being present or the class file's generic types.boolean
Generates a unique name for the interceptor.Return theRegistrationBehavior
associated with this interceptor.Return the name of the cache this interceptor should receive events from.Return the set of event types this interceptor is concerned with.Return the wrapped interceptor.getOrder()
Return the priority of this interceptor in the chain of interceptors.Return registered name ofEventInterceptor
.Return the name of the service this interceptor should receive events from.int
hashCode()
void
introduceEventDispatcher
(String sIdentifier, EventDispatcher dispatcher) Introduce and possibly bind thisEventInterceptor
to the specifiedEventDispatcher
.boolean
isAcceptable
(EventDispatcher dispatcher) Determine whether theEventDispatcher
should be accepted by this interceptor.boolean
isFirst()
Return whether this interceptor should request to be first in the chain of interceptors.void
Perform necessary processing of the specifiedEvent
.toString()
-
Constructor Details
-
NamedEventInterceptor
Construct a NamedEventInterceptor for the specified interceptor.- Parameters:
interceptor
- theEventInterceptor
-
NamedEventInterceptor
Construct a NamedEventInterceptor for the specified interceptor and unique identifier.- Parameters:
sName
- the registered name of the wrapped interceptorinterceptor
- theEventInterceptor
-
NamedEventInterceptor
public NamedEventInterceptor(String sName, EventInterceptor<E> interceptor, RegistrationBehavior behavior) Construct a NamedEventInterceptor for the specified interceptor and unique identifier.- Parameters:
sName
- the registered name of the wrapped interceptorinterceptor
- theEventInterceptor
behavior
- the behavior enacted upon discovering duplicate interceptors
-
NamedEventInterceptor
public NamedEventInterceptor(String sName, EventInterceptor<E> interceptor, String sCacheName, String sServiceName, Interceptor.Order order, RegistrationBehavior behavior) Construct a NamedEventInterceptor for the specified interceptor.- Parameters:
sName
- the registered name of the wrapped interceptorinterceptor
- theEventInterceptor
sCacheName
- the name of the cache this interceptor is targeted tosServiceName
- the name of the service this interceptor is targeted toorder
- whether this interceptor should be first in the chain of interceptorsbehavior
- the behavior enacted upon discovering duplicate interceptors
-
NamedEventInterceptor
Construct a NamedEventInterceptor for the specified interceptor using the provided NamedEventInterceptor as the source to clone from.- Parameters:
interceptor
- theEventInterceptor
incptrNamed
- the NamedEventInterceptor to clone from
-
NamedEventInterceptor
public NamedEventInterceptor(String sName, EventInterceptor<E> interceptor, String sCacheName, String sServiceName, Interceptor.Order order, RegistrationBehavior behavior, Set<Enum> setEventTypes) Construct a NamedEventInterceptor for the specified interceptor.- Parameters:
sName
- the registered name of the wrapped interceptorinterceptor
- theEventInterceptor
sCacheName
- the name of the cache this interceptor is targeted tosServiceName
- the name of the service this interceptor is targeted toorder
- whether this interceptor should be first in the chain of interceptorsbehavior
- the behavior enacted upon discovering duplicate interceptorssetEventTypes
- the set of event types the interceptor is interested in
-
-
Method Details
-
getRegisteredName
Return registered name ofEventInterceptor
.- Returns:
- registered name of
EventInterceptor
-
getInterceptor
Return the wrapped interceptor.- Returns:
- the wrapped interceptor
-
getEventTypes
Return the set of event types this interceptor is concerned with.- Returns:
- the set of event types this interceptor is concerned with
-
getServiceName
Return the name of the service this interceptor should receive events from.- Returns:
- the name of the service this interceptor should receive events from
-
getCacheName
Return the name of the cache this interceptor should receive events from.- Returns:
- the name of the cache this interceptor should receive events from
-
isFirst
public boolean isFirst()Return whether this interceptor should request to be first in the chain of interceptors.- Returns:
- whether this interceptor should request to be first in the chain of interceptors
-
getOrder
Return the priority of this interceptor in the chain of interceptors.- Returns:
- the priority of this interceptor in the chain of interceptors
-
getBehavior
Return theRegistrationBehavior
associated with this interceptor.- Returns:
- the RegistrationBehavior associated with this interceptor
-
onEvent
Perform necessary processing of the specifiedEvent
.- Specified by:
onEvent
in interfaceEventInterceptor<E extends Event<?>>
- Parameters:
event
- the Event to be processed- See Also:
-
introduceEventDispatcher
Introduce and possibly bind thisEventInterceptor
to the specifiedEventDispatcher
.Note that EventInterceptors are responsible for determining whether they should be registered with an EventDispatcher by calling
EventDispatcher.addEventInterceptor(com.tangosol.net.events.EventInterceptor<E>)
.- Specified by:
introduceEventDispatcher
in interfaceEventDispatcherAwareInterceptor<E extends Event<?>>
- Parameters:
sIdentifier
- the unique name identifying this interceptordispatcher
- the dispatcher being introduced
-
isAcceptable
Determine whether theEventDispatcher
should be accepted by this interceptor.- Parameters:
dispatcher
- the EventDispatcher being introduced
-
generateName
Generates a unique name for the interceptor. The unique name will be generated by appending a'$'
following by an increasing integer.- Returns:
- a unique name for the interceptor
-
toString
-
equals
-
hashCode
public int hashCode() -
ensureInitialized
protected final void ensureInitialized()Based on the state of the NamedEventInterceptor populate any uninitialized values based on either an annotation being present or the class file's generic types.
-