Class CommandInterceptor

  • All Implemented Interfaces:
    org.infinispan.commands.Visitor, AsyncInterceptor
    Direct Known Subclasses:
    BaseCustomInterceptor, PrePostProcessingCommandInterceptor

    @Deprecated
    public abstract class CommandInterceptor
    extends org.infinispan.commands.AbstractVisitor
    implements AsyncInterceptor
    Deprecated.
    Since 9.0, please extend BaseAsyncInterceptor instead.
    This is the base class for all interceptors to extend, and implements the Visitor interface allowing it to intercept invocations on VisitableCommands.

    Commands are either created by the CacheImpl (for invocations on the Cache public interface), or by the InboundInvocationHandler for remotely originating invocations, and are passed up the interceptor chain by using the InterceptorChain helper class.

    When writing interceptors, authors can either override a specific visitXXX() method (such as AbstractVisitor.visitGetKeyValueCommand(InvocationContext, GetKeyValueCommand)) or the more generic handleDefault(InvocationContext, VisitableCommand) which is the default behaviour of any visit method, as defined in AbstractVisitor.handleDefault(InvocationContext, VisitableCommand).

    The preferred approach is to override the specific visitXXX() methods that are of interest rather than to override handleDefault(InvocationContext, VisitableCommand) and then write a series of if statements or a switch block, if command-specific behaviour is needed.

    Author:
    Mircea.Markus@jboss.com
    See Also:
    VisitableCommand, Visitor, InterceptorChain
    • Constructor Summary

      Constructors 
      Constructor Description
      CommandInterceptor()
      Deprecated.
       
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected <K,​V>
      Cache<K,​V>
      getCacheWithFlags​(Cache<K,​V> cache, org.infinispan.commands.FlagAffectedCommand command)
      Deprecated.
       
      protected long getLockAcquisitionTimeout​(org.infinispan.commands.FlagAffectedCommand command, boolean skipLocking)
      Deprecated.
       
      protected org.infinispan.util.logging.Log getLog()
      Deprecated.
       
      CommandInterceptor getNext()
      Deprecated.
      Retrieves the next interceptor in the chain.
      protected java.lang.Object handleDefault​(InvocationContext ctx, org.infinispan.commands.VisitableCommand command)
      Deprecated.
      The default behaviour of the visitXXX methods, which is to ignore the call and pass the call up to the next interceptor in the chain.
      boolean hasNext()
      Deprecated.
      Note: Unlike getNext(), this method does not ignore interceptors that do not extend CommandInterceptor
      protected boolean hasSkipLocking​(org.infinispan.commands.FlagAffectedCommand command)
      Deprecated.
       
      java.lang.Object invokeNextInterceptor​(InvocationContext ctx, org.infinispan.commands.VisitableCommand command)
      Deprecated.
      Invokes the next interceptor in the chain.
      void setNext​(CommandInterceptor ignored)
      Deprecated.
      Does nothing since 9.0.
      void setNextInterceptor​(AsyncInterceptor interceptorStage)
      Deprecated.
      Sets up the interceptor.
      java.lang.Object visitCommand​(InvocationContext ctx, org.infinispan.commands.VisitableCommand command)
      Deprecated.
      Perform some work for a command invocation.
      • Methods inherited from class org.infinispan.commands.AbstractVisitor

        visitClearCommand, visitCollection, visitCommitCommand, visitComputeCommand, visitComputeIfAbsentCommand, visitDistributedExecuteCommand, visitEntrySetCommand, visitEvictCommand, visitGetAllCommand, visitGetCacheEntryCommand, visitGetKeysInGroupCommand, visitGetKeyValueCommand, visitInvalidateCommand, visitInvalidateL1Command, visitKeySetCommand, visitLockControlCommand, visitPrepareCommand, visitPutKeyValueCommand, visitPutMapCommand, visitReadOnlyKeyCommand, visitReadOnlyManyCommand, visitReadWriteKeyCommand, visitReadWriteKeyValueCommand, visitReadWriteManyCommand, visitReadWriteManyEntriesCommand, visitRemoveCommand, visitReplaceCommand, visitRollbackCommand, visitSizeCommand, visitUnknownCommand, visitWriteOnlyKeyCommand, visitWriteOnlyKeyValueCommand, visitWriteOnlyManyCommand, visitWriteOnlyManyEntriesCommand
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.infinispan.commands.Visitor

        visitApplyDeltaCommand, visitRemoveExpiredCommand
    • Field Detail

      • cacheConfiguration

        protected Configuration cacheConfiguration
        Deprecated.
    • Constructor Detail

      • CommandInterceptor

        public CommandInterceptor()
        Deprecated.
    • Method Detail

      • getLog

        protected org.infinispan.util.logging.Log getLog()
        Deprecated.
      • getNext

        public final CommandInterceptor getNext()
        Deprecated.
        Retrieves the next interceptor in the chain. Since 9.0, it returns null if the next interceptor does not extend CommandInterceptor.
        Returns:
        the next interceptor in the chain.
      • hasNext

        public final boolean hasNext()
        Deprecated.
        Note: Unlike getNext(), this method does not ignore interceptors that do not extend CommandInterceptor
        Returns:
        true if there is another interceptor in the chain after this; false otherwise.
      • setNext

        public final void setNext​(CommandInterceptor ignored)
        Deprecated.
        Does nothing since 9.0.
      • invokeNextInterceptor

        public final java.lang.Object invokeNextInterceptor​(InvocationContext ctx,
                                                            org.infinispan.commands.VisitableCommand command)
                                                     throws java.lang.Throwable
        Deprecated.
        Invokes the next interceptor in the chain. This is how interceptor implementations should pass a call up the chain to the next interceptor.
        Parameters:
        ctx - invocation context
        command - command to pass up the chain.
        Returns:
        return value of the invocation
        Throws:
        java.lang.Throwable - in the event of problems
      • handleDefault

        protected java.lang.Object handleDefault​(InvocationContext ctx,
                                                 org.infinispan.commands.VisitableCommand command)
                                          throws java.lang.Throwable
        Deprecated.
        The default behaviour of the visitXXX methods, which is to ignore the call and pass the call up to the next interceptor in the chain.
        Overrides:
        handleDefault in class org.infinispan.commands.AbstractVisitor
        Parameters:
        ctx - invocation context
        command - command to invoke
        Returns:
        return value
        Throws:
        java.lang.Throwable - in the event of problems
      • getLockAcquisitionTimeout

        protected final long getLockAcquisitionTimeout​(org.infinispan.commands.FlagAffectedCommand command,
                                                       boolean skipLocking)
        Deprecated.
      • hasSkipLocking

        protected final boolean hasSkipLocking​(org.infinispan.commands.FlagAffectedCommand command)
        Deprecated.
      • getCacheWithFlags

        protected <K,​V> Cache<K,​V> getCacheWithFlags​(Cache<K,​V> cache,
                                                                 org.infinispan.commands.FlagAffectedCommand command)
        Deprecated.