Class InterceptorChain


  • @Deprecated
    public class InterceptorChain
    extends Object
    Deprecated.
    Since 9.0, use AsyncInterceptorChain instead. Some methods will ignore the interceptors that do not extend CommandInterceptor.
    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 Detail

      • InterceptorChain

        public InterceptorChain()
        Deprecated.
    • 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

        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 chain
        toBeReplacedInterceptorType - 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 with InvocationContext.clone().

      • 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.