@Deprecated public abstract class CommandInterceptor extends AbstractVisitor implements AsyncInterceptor
Visitor
interface allowing it to
intercept invocations on VisitableCommand
s.
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.
VisitableCommand
,
Visitor
,
InterceptorChain
Modifier and Type | Field and Description |
---|---|
protected Configuration |
cacheConfiguration
Deprecated.
|
Constructor and Description |
---|
CommandInterceptor()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected <K,V> Cache<K,V> |
getCacheWithFlags(Cache<K,V> cache,
FlagAffectedCommand command)
Deprecated.
|
protected long |
getLockAcquisitionTimeout(FlagAffectedCommand command,
boolean skipLocking)
Deprecated.
|
protected Log |
getLog()
Deprecated.
|
CommandInterceptor |
getNext()
Deprecated.
Retrieves the next interceptor in the chain.
|
protected Object |
handleDefault(InvocationContext ctx,
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(FlagAffectedCommand command)
Deprecated.
|
void |
injectConfiguration(Configuration configuration,
AsyncInterceptorChain interceptorChain)
Deprecated.
|
Object |
invokeNextInterceptor(InvocationContext ctx,
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,
VisitableCommand command)
Deprecated.
Perform some work for a command invocation.
|
visitApplyDeltaCommand, visitClearCommand, visitCollection, visitCommitCommand, 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
protected Configuration cacheConfiguration
protected Log getLog()
public void injectConfiguration(Configuration configuration, AsyncInterceptorChain interceptorChain)
public final CommandInterceptor getNext()
null
if the next interceptor does not extend CommandInterceptor
.public final boolean hasNext()
getNext()
, this method does not ignore interceptors that do not extend
CommandInterceptor
public final void setNext(CommandInterceptor ignored)
public final void setNextInterceptor(AsyncInterceptor interceptorStage)
AsyncInterceptor
setNextInterceptor
in interface AsyncInterceptor
public final Object invokeNextInterceptor(InvocationContext ctx, VisitableCommand command) throws Throwable
ctx
- invocation contextcommand
- command to pass up the chain.Throwable
- in the event of problemsprotected Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
handleDefault
in class AbstractVisitor
ctx
- invocation contextcommand
- command to invokeThrowable
- in the event of problemsprotected final long getLockAcquisitionTimeout(FlagAffectedCommand command, boolean skipLocking)
protected final boolean hasSkipLocking(FlagAffectedCommand command)
protected <K,V> Cache<K,V> getCacheWithFlags(Cache<K,V> cache, FlagAffectedCommand command)
public Object visitCommand(InvocationContext ctx, VisitableCommand command) throws Throwable
AsyncInterceptor
BaseAsyncInterceptor.invokeNext(InvocationContext, VisitableCommand)
or the other methods in
BaseAsyncInterceptor
.visitCommand
in interface AsyncInterceptor
InvocationStage
created by the BaseAsyncInterceptor
methods.Throwable
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.