Package org.infinispan.interceptors
Class InterceptorChain
- java.lang.Object
-
- org.infinispan.interceptors.InterceptorChain
-
@Deprecated public class InterceptorChain extends Object
Deprecated.Since 9.0, useAsyncInterceptorChain
instead. Some methods will ignore the interceptors that do not extendCommandInterceptor
.Knows how to build and manage an chain of interceptors. Also in charge with invoking methods on the chain.- Since:
- 4.0
- Author:
- Mircea.Markus@jboss.com, Galder ZamarreƱo
-
-
Constructor Summary
Constructors Constructor Description InterceptorChain()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addInterceptor(CommandInterceptor interceptor, int position)
Deprecated.Inserts the given interceptor at the specified position in the chain (o based indexing).boolean
addInterceptorAfter(CommandInterceptor toAdd, Class<? extends CommandInterceptor> afterInterceptor)
Deprecated.Adds a new interceptor in list after an interceptor of a given type.boolean
addInterceptorBefore(CommandInterceptor toAdd, Class<? extends CommandInterceptor> beforeInterceptor)
Deprecated.Adds a new interceptor in list after an interceptor of a given type.boolean
addInterceptorBefore(CommandInterceptor toAdd, Class<? extends CommandInterceptor> beforeInterceptor, boolean isCustom)
Deprecated.UseaddInterceptorBefore(CommandInterceptor, Class)
instead.void
appendInterceptor(CommandInterceptor ci, boolean isCustom)
Deprecated.Appends at the end.List<CommandInterceptor>
asList()
Deprecated.Returns an unmofiable list with all the interceptors in sequence.boolean
containsInstance(CommandInterceptor interceptor)
Deprecated.Checks whether the chain contains the supplied interceptor instance.boolean
containsInterceptorType(Class<? extends CommandInterceptor> interceptorType)
Deprecated.boolean
containsInterceptorType(Class<? extends CommandInterceptor> interceptorType, boolean alsoMatchSubClasses)
Deprecated.CommandInterceptor
getFirstInChain()
Deprecated.List<CommandInterceptor>
getInterceptorsWhichExtend(Class<? extends CommandInterceptor> interceptorClass)
Deprecated.Returns all interceptors which extend the given command interceptor.List<CommandInterceptor>
getInterceptorsWithClass(Class clazz)
Deprecated.Returns all the interceptors that have the fully qualified name of their class equal with the supplied class name.Object
invoke(InvocationContext ctx, org.infinispan.commands.VisitableCommand command)
Deprecated.Walks the command through the interceptor chain.void
removeInterceptor(int position)
Deprecated.Removes the interceptor at the given postion.void
removeInterceptor(Class<? extends CommandInterceptor> clazz)
Deprecated.Removes all the occurences of supplied interceptor type from the chain.boolean
replaceInterceptor(CommandInterceptor replacingInterceptor, Class<? extends CommandInterceptor> toBeReplacedInterceptorType)
Deprecated.Replaces an existing interceptor of the given type in the interceptor chain with a new interceptor instance passed as parameter.void
setFirstInChain(CommandInterceptor interceptor)
Deprecated.Mainly used by unit tests to replace the interceptor chain with the starting point passed in.int
size()
Deprecated.Returns the number of interceptors in the chain.
-
-
-
Method Detail
-
addInterceptor
public void addInterceptor(CommandInterceptor interceptor, int position)
Deprecated.Inserts the given interceptor at the specified position in the chain (o based indexing).- Throws:
IllegalArgumentException
- if the position is invalid (e.g. 5 and there are only 2 interceptors in the chain)
-
removeInterceptor
public void removeInterceptor(int position)
Deprecated.Removes the interceptor at the given postion.- Throws:
IllegalArgumentException
- if the position is invalid (e.g. 5 and there are only 2 interceptors in the chain)
-
size
public int size()
Deprecated.Returns the number of interceptors in the chain.
-
asList
public List<CommandInterceptor> asList()
Deprecated.Returns an unmofiable list with all the interceptors in sequence. If first in chain is null an empty list is returned.
-
removeInterceptor
public void removeInterceptor(Class<? extends CommandInterceptor> clazz)
Deprecated.Removes all the occurences of supplied interceptor type from the chain.
-
addInterceptorAfter
public boolean addInterceptorAfter(CommandInterceptor toAdd, Class<? extends CommandInterceptor> afterInterceptor)
Deprecated.Adds a new interceptor in list after an interceptor of a given type.- Returns:
- true if the interceptor was added; i.e. the afterInterceptor exists
-
addInterceptorBefore
@Deprecated public boolean addInterceptorBefore(CommandInterceptor toAdd, Class<? extends CommandInterceptor> beforeInterceptor, boolean isCustom)
Deprecated.UseaddInterceptorBefore(CommandInterceptor, Class)
instead.
-
addInterceptorBefore
public boolean addInterceptorBefore(CommandInterceptor toAdd, Class<? extends CommandInterceptor> beforeInterceptor)
Deprecated.Adds a new interceptor in list after an interceptor of a given type.- Returns:
- true if the interceptor was added; i.e. the afterInterceptor exists
-
replaceInterceptor
public boolean replaceInterceptor(CommandInterceptor replacingInterceptor, Class<? extends CommandInterceptor> toBeReplacedInterceptorType)
Deprecated.Replaces an existing interceptor of the given type in the interceptor chain with a new interceptor instance passed as parameter.- 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(CommandInterceptor ci, boolean isCustom)
Deprecated.Appends at the end.
-
invoke
public Object invoke(InvocationContext ctx, org.infinispan.commands.VisitableCommand command)
Deprecated.Walks the command through the interceptor chain. The received ctx is being passed in.Note: Reusing the context for multiple invocations is allowed. However, the two invocations must not overlap, so calling
invoke(ctx, command)
from an interceptor is not allowed. If an interceptor needs to invoke a new command through the entire chain, it must first copy the invocation context withInvocationContext.clone()
.
-
getFirstInChain
@Deprecated public CommandInterceptor getFirstInChain()
Deprecated.- Returns:
- the first
CommandInterceptor
in the chain. Since 9.0, there will likely be otherAsyncInterceptor
s before it.
-
setFirstInChain
public void setFirstInChain(CommandInterceptor interceptor)
Deprecated.Mainly used by unit tests to replace the interceptor chain with the starting point passed in.- Parameters:
interceptor
- interceptor to be used as the first interceptor in the chain.
-
getInterceptorsWhichExtend
public List<CommandInterceptor> getInterceptorsWhichExtend(Class<? extends CommandInterceptor> interceptorClass)
Deprecated.Returns all interceptors which extend the given command interceptor.
-
getInterceptorsWithClass
public List<CommandInterceptor> getInterceptorsWithClass(Class clazz)
Deprecated.Returns all the interceptors that have the fully qualified name of their class equal with the supplied class name.
-
containsInstance
public boolean containsInstance(CommandInterceptor interceptor)
Deprecated.Checks whether the chain contains the supplied interceptor instance.
-
containsInterceptorType
public boolean containsInterceptorType(Class<? extends CommandInterceptor> interceptorType)
Deprecated.
-
containsInterceptorType
public boolean containsInterceptorType(Class<? extends CommandInterceptor> interceptorType, boolean alsoMatchSubClasses)
Deprecated.
-
-