Package org.infinispan.interceptors.base
Class CommandInterceptor
- java.lang.Object
-
- org.infinispan.commands.AbstractVisitor
-
- org.infinispan.interceptors.base.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 extendBaseAsyncInterceptor
instead.This is the base class for all interceptors to extend, and implements theVisitor
interface allowing it to intercept invocations onVisitableCommand
s. Commands are either created by theCacheImpl
(for invocations on theCache
public interface), or by theInboundInvocationHandler
for remotely originating invocations, and are passed up the interceptor chain by using theInterceptorChain
helper class. When writing interceptors, authors can either override a specific visitXXX() method (such asAbstractVisitor.visitGetKeyValueCommand(InvocationContext, GetKeyValueCommand)
) or the more generichandleDefault(InvocationContext, VisitableCommand)
which is the default behaviour of any visit method, as defined inAbstractVisitor.handleDefault(InvocationContext, VisitableCommand)
. The preferred approach is to override the specific visitXXX() methods that are of interest rather than to overridehandleDefault(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
-
-
Field Summary
Fields Modifier and Type Field Description protected Configuration
cacheConfiguration
Deprecated.
-
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 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: UnlikegetNext()
, this method does not ignore interceptors that do not extendCommandInterceptor
protected boolean
hasSkipLocking(org.infinispan.commands.FlagAffectedCommand command)
Deprecated.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.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
-
-
-
-
Field Detail
-
cacheConfiguration
protected Configuration cacheConfiguration
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 returnsnull
if the next interceptor does not extendCommandInterceptor
.- Returns:
- the next interceptor in the chain.
-
hasNext
public final boolean hasNext()
Deprecated.Note: UnlikegetNext()
, this method does not ignore interceptors that do not extendCommandInterceptor
- 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.
-
setNextInterceptor
public final void setNextInterceptor(AsyncInterceptor interceptorStage)
Deprecated.Description copied from interface:AsyncInterceptor
Sets up the interceptor. Do not call explicitly.- Specified by:
setNextInterceptor
in interfaceAsyncInterceptor
-
invokeNextInterceptor
public final Object invokeNextInterceptor(InvocationContext ctx, org.infinispan.commands.VisitableCommand command) throws 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 contextcommand
- command to pass up the chain.- Returns:
- return value of the invocation
- Throws:
Throwable
- in the event of problems
-
handleDefault
protected Object handleDefault(InvocationContext ctx, org.infinispan.commands.VisitableCommand command) throws 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 classorg.infinispan.commands.AbstractVisitor
- Parameters:
ctx
- invocation contextcommand
- command to invoke- Returns:
- return value
- Throws:
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.
-
visitCommand
public Object visitCommand(InvocationContext ctx, org.infinispan.commands.VisitableCommand command) throws Throwable
Deprecated.Description copied from interface:AsyncInterceptor
Perform some work for a command invocation. The interceptor is responsible for invoking the next interceptor in the chain, usingBaseAsyncInterceptor.invokeNext(InvocationContext, VisitableCommand)
or the other methods inBaseAsyncInterceptor
.- Specified by:
visitCommand
in interfaceAsyncInterceptor
- Returns:
- Either a regular value, or an
InvocationStage
created by theBaseAsyncInterceptor
methods. - Throws:
Throwable
-
-