Package org.infinispan.interceptors
Class EmptyAsyncInterceptorChain
- java.lang.Object
-
- org.infinispan.interceptors.EmptyAsyncInterceptorChain
-
- All Implemented Interfaces:
AsyncInterceptorChain
public class EmptyAsyncInterceptorChain extends Object implements AsyncInterceptorChain
- Since:
- 9.0
- Author:
- Dan Berindei
-
-
Field Summary
Fields Modifier and Type Field Description static EmptyAsyncInterceptorChainINSTANCE
-
Constructor Summary
Constructors Constructor Description EmptyAsyncInterceptorChain()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInterceptor(AsyncInterceptor interceptor, int position)Inserts the given interceptor at the specified position in the chain (0 based indexing).booleanaddInterceptorAfter(AsyncInterceptor toAdd, Class<? extends AsyncInterceptor> afterInterceptor)Adds a new interceptor in list after an interceptor of a given type.booleanaddInterceptorBefore(AsyncInterceptor toAdd, Class<? extends AsyncInterceptor> beforeInterceptor)Adds a new interceptor in list before an interceptor of a given type.voidappendInterceptor(AsyncInterceptor ci, boolean isCustom)Appends at the end.booleancontainsInstance(AsyncInterceptor interceptor)Checks whether the chain contains the supplied interceptor instance.booleancontainsInterceptorType(Class<? extends AsyncInterceptor> interceptorType)Checks whether the chain contains an interceptor with the given class.booleancontainsInterceptorType(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, ornullif there is none.<T extends AsyncInterceptor>
TfindInterceptorWithClass(Class<T> interceptorClass)Returns the first interceptor with the given class, ornullif there is none.List<AsyncInterceptor>getInterceptors()Objectinvoke(InvocationContext ctx, VisitableCommand command)Walks the command through the interceptor chain.CompletableFuture<Object>invokeAsync(InvocationContext ctx, VisitableCommand command)Walks the command through the interceptor chain.voidremoveInterceptor(int position)Removes the interceptor at the given position.voidremoveInterceptor(Class<? extends AsyncInterceptor> clazz)Removes all the occurrences of supplied interceptor type from the chain.booleanreplaceInterceptor(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.intsize()Returns the number of interceptors in the chain.
-
-
-
Field Detail
-
INSTANCE
public static final EmptyAsyncInterceptorChain INSTANCE
-
-
Method Detail
-
getInterceptors
public List<AsyncInterceptor> getInterceptors()
- Specified by:
getInterceptorsin interfaceAsyncInterceptorChain- Returns:
- An immutable list of the current interceptors.
-
addInterceptor
public void addInterceptor(AsyncInterceptor interceptor, int position)
Description copied from interface:AsyncInterceptorChainInserts the given interceptor at the specified position in the chain (0 based indexing).- Specified by:
addInterceptorin interfaceAsyncInterceptorChain
-
removeInterceptor
public void removeInterceptor(int position)
Description copied from interface:AsyncInterceptorChainRemoves the interceptor at the given position.- Specified by:
removeInterceptorin interfaceAsyncInterceptorChain
-
size
public int size()
Description copied from interface:AsyncInterceptorChainReturns the number of interceptors in the chain.- Specified by:
sizein interfaceAsyncInterceptorChain
-
removeInterceptor
public void removeInterceptor(Class<? extends AsyncInterceptor> clazz)
Description copied from interface:AsyncInterceptorChainRemoves all the occurrences of supplied interceptor type from the chain.- Specified by:
removeInterceptorin interfaceAsyncInterceptorChain
-
addInterceptorAfter
public boolean addInterceptorAfter(AsyncInterceptor toAdd, Class<? extends AsyncInterceptor> afterInterceptor)
Description copied from interface:AsyncInterceptorChainAdds a new interceptor in list after an interceptor of a given type.- Specified by:
addInterceptorAfterin interfaceAsyncInterceptorChain- Returns:
- true if the interceptor was added; i.e. the
afterInterceptorexists
-
addInterceptorBefore
public boolean addInterceptorBefore(AsyncInterceptor toAdd, Class<? extends AsyncInterceptor> beforeInterceptor)
Description copied from interface:AsyncInterceptorChainAdds a new interceptor in list before an interceptor of a given type.- Specified by:
addInterceptorBeforein interfaceAsyncInterceptorChain- Returns:
- true if the interceptor was added; i.e. the
beforeInterceptorexists
-
replaceInterceptor
public boolean replaceInterceptor(AsyncInterceptor replacingInterceptor, Class<? extends AsyncInterceptor> toBeReplacedInterceptorType)
Description copied from interface:AsyncInterceptorChainReplaces an existing interceptor of the given type in the interceptor chain with a new interceptor instance passed as parameter.- Specified by:
replaceInterceptorin 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
public void appendInterceptor(AsyncInterceptor ci, boolean isCustom)
Description copied from interface:AsyncInterceptorChainAppends at the end.- Specified by:
appendInterceptorin interfaceAsyncInterceptorChain
-
invoke
public Object invoke(InvocationContext ctx, VisitableCommand command)
Description copied from interface:AsyncInterceptorChainWalks 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:
invokein interfaceAsyncInterceptorChain
-
invokeAsync
public CompletableFuture<Object> invokeAsync(InvocationContext ctx, VisitableCommand command)
Description copied from interface:AsyncInterceptorChainWalks the command through the interceptor chain. The received ctx is being passed in.- Specified by:
invokeAsyncin interfaceAsyncInterceptorChain
-
findInterceptorExtending
public <T extends AsyncInterceptor> T findInterceptorExtending(Class<T> interceptorClass)
Description copied from interface:AsyncInterceptorChainReturns the first interceptor extending the given class, ornullif there is none.- Specified by:
findInterceptorExtendingin interfaceAsyncInterceptorChain
-
findInterceptorWithClass
public <T extends AsyncInterceptor> T findInterceptorWithClass(Class<T> interceptorClass)
Description copied from interface:AsyncInterceptorChainReturns the first interceptor with the given class, ornullif there is none.- Specified by:
findInterceptorWithClassin interfaceAsyncInterceptorChain
-
containsInstance
public boolean containsInstance(AsyncInterceptor interceptor)
Description copied from interface:AsyncInterceptorChainChecks whether the chain contains the supplied interceptor instance.- Specified by:
containsInstancein interfaceAsyncInterceptorChain
-
containsInterceptorType
public boolean containsInterceptorType(Class<? extends AsyncInterceptor> interceptorType)
Description copied from interface:AsyncInterceptorChainChecks whether the chain contains an interceptor with the given class.- Specified by:
containsInterceptorTypein interfaceAsyncInterceptorChain
-
containsInterceptorType
public boolean containsInterceptorType(Class<? extends AsyncInterceptor> interceptorType, boolean alsoMatchSubClasses)
Description copied from interface:AsyncInterceptorChainChecks whether the chain contains an interceptor with the given class, or a subclass.- Specified by:
containsInterceptorTypein interfaceAsyncInterceptorChain
-
-