Package org.infinispan.interceptors
Class EmptyAsyncInterceptorChain
java.lang.Object
org.infinispan.interceptors.EmptyAsyncInterceptorChain
- All Implemented Interfaces:
AsyncInterceptorChain
- Since:
- 9.0
- Author:
- Dan Berindei
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addInterceptor
(AsyncInterceptor interceptor, int position) Inserts the given interceptor at the specified position in the chain (0 based indexing).boolean
addInterceptorAfter
(AsyncInterceptor toAdd, Class<? extends AsyncInterceptor> afterInterceptor) Adds a new interceptor in list after an interceptor of a given type.boolean
addInterceptorBefore
(AsyncInterceptor toAdd, Class<? extends AsyncInterceptor> beforeInterceptor) Adds a new interceptor in list before an interceptor of a given type.void
appendInterceptor
(AsyncInterceptor ci, boolean isCustom) Appends at the end.boolean
containsInstance
(AsyncInterceptor interceptor) Checks whether the chain contains the supplied interceptor instance.boolean
containsInterceptorType
(Class<? extends AsyncInterceptor> interceptorType) Checks whether the chain contains an interceptor with the given class.boolean
containsInterceptorType
(Class<? extends AsyncInterceptor> interceptorType, boolean alsoMatchSubClasses) Checks whether the chain contains an interceptor with the given class, or a subclass.<T extends AsyncInterceptor>
TfindInterceptorExtending
(Class<T> interceptorClass) Returns the first interceptor extending the given class, ornull
if there is none.<T extends AsyncInterceptor>
TfindInterceptorWithClass
(Class<T> interceptorClass) Returns the first interceptor with the given class, ornull
if there is none.invoke
(InvocationContext ctx, VisitableCommand command) Walks the command through the interceptor chain.invokeAsync
(InvocationContext ctx, VisitableCommand command) Walks the command through the interceptor chain.invokeStage
(InvocationContext ctx, VisitableCommand command) Walks the command through the interceptor chain.void
removeInterceptor
(int position) Removes the interceptor at the given position.void
removeInterceptor
(Class<? extends AsyncInterceptor> clazz) Removes all the occurrences of supplied interceptor type from the chain.boolean
replaceInterceptor
(AsyncInterceptor replacingInterceptor, Class<? extends AsyncInterceptor> toBeReplacedInterceptorType) Replaces an existing interceptor of the given type in the interceptor chain with a new interceptor instance passed as parameter.int
size()
Returns the number of interceptors in the chain.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
EmptyAsyncInterceptorChain
public EmptyAsyncInterceptorChain()
-
-
Method Details
-
getInterceptors
- Specified by:
getInterceptors
in interfaceAsyncInterceptorChain
- Returns:
- An immutable list of the current interceptors.
-
addInterceptor
Description copied from interface:AsyncInterceptorChain
Inserts the given interceptor at the specified position in the chain (0 based indexing).- Specified by:
addInterceptor
in interfaceAsyncInterceptorChain
-
removeInterceptor
public void removeInterceptor(int position) Description copied from interface:AsyncInterceptorChain
Removes the interceptor at the given position.- Specified by:
removeInterceptor
in interfaceAsyncInterceptorChain
-
size
public int size()Description copied from interface:AsyncInterceptorChain
Returns the number of interceptors in the chain.- Specified by:
size
in interfaceAsyncInterceptorChain
-
removeInterceptor
Description copied from interface:AsyncInterceptorChain
Removes all the occurrences of supplied interceptor type from the chain.- Specified by:
removeInterceptor
in interfaceAsyncInterceptorChain
-
addInterceptorAfter
public boolean addInterceptorAfter(AsyncInterceptor toAdd, Class<? extends AsyncInterceptor> afterInterceptor) Description copied from interface:AsyncInterceptorChain
Adds a new interceptor in list after an interceptor of a given type.- Specified by:
addInterceptorAfter
in interfaceAsyncInterceptorChain
- Returns:
- true if the interceptor was added; i.e. the
afterInterceptor
exists
-
addInterceptorBefore
public boolean addInterceptorBefore(AsyncInterceptor toAdd, Class<? extends AsyncInterceptor> beforeInterceptor) Description copied from interface:AsyncInterceptorChain
Adds a new interceptor in list before an interceptor of a given type.- Specified by:
addInterceptorBefore
in interfaceAsyncInterceptorChain
- Returns:
- true if the interceptor was added; i.e. the
beforeInterceptor
exists
-
replaceInterceptor
public boolean replaceInterceptor(AsyncInterceptor replacingInterceptor, Class<? extends AsyncInterceptor> toBeReplacedInterceptorType) Description copied from interface:AsyncInterceptorChain
Replaces an existing interceptor of the given type in the interceptor chain with a new interceptor instance passed as parameter.- Specified by:
replaceInterceptor
in interfaceAsyncInterceptorChain
- Parameters:
replacingInterceptor
- the interceptor to add to the interceptor chaintoBeReplacedInterceptorType
- the type of interceptor that should be swapped with the new one- Returns:
- true if the interceptor was replaced
-
appendInterceptor
Description copied from interface:AsyncInterceptorChain
Appends at the end.- Specified by:
appendInterceptor
in interfaceAsyncInterceptorChain
-
invoke
Description copied from interface:AsyncInterceptorChain
Walks the command through the interceptor chain. The received ctx is being passed in.Note: Reusing the context for multiple invocations is allowed, however most context implementations are not thread-safe.
- Specified by:
invoke
in interfaceAsyncInterceptorChain
-
invokeAsync
Description copied from interface:AsyncInterceptorChain
Walks the command through the interceptor chain. The received ctx is being passed in.Note: Reusing the context for multiple invocations is allowed, however most context implementations are not thread-safe.
- Specified by:
invokeAsync
in interfaceAsyncInterceptorChain
-
invokeStage
Description copied from interface:AsyncInterceptorChain
Walks the command through the interceptor chain. The received ctx is being passed in.Note: Reusing the context for multiple invocations is allowed, however most context implementations are not thread-safe.
- Specified by:
invokeStage
in interfaceAsyncInterceptorChain
-
findInterceptorExtending
Description copied from interface:AsyncInterceptorChain
Returns the first interceptor extending the given class, ornull
if there is none.- Specified by:
findInterceptorExtending
in interfaceAsyncInterceptorChain
-
findInterceptorWithClass
Description copied from interface:AsyncInterceptorChain
Returns the first interceptor with the given class, ornull
if there is none.- Specified by:
findInterceptorWithClass
in interfaceAsyncInterceptorChain
-
containsInstance
Description copied from interface:AsyncInterceptorChain
Checks whether the chain contains the supplied interceptor instance.- Specified by:
containsInstance
in interfaceAsyncInterceptorChain
-
containsInterceptorType
Description copied from interface:AsyncInterceptorChain
Checks whether the chain contains an interceptor with the given class.- Specified by:
containsInterceptorType
in interfaceAsyncInterceptorChain
-
containsInterceptorType
public boolean containsInterceptorType(Class<? extends AsyncInterceptor> interceptorType, boolean alsoMatchSubClasses) Description copied from interface:AsyncInterceptorChain
Checks whether the chain contains an interceptor with the given class, or a subclass.- Specified by:
containsInterceptorType
in interfaceAsyncInterceptorChain
-