|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.infinispan.commands.AbstractVisitor
org.infinispan.interceptors.base.CommandInterceptor
public abstract class CommandInterceptor
This is the base class for all interceptors to extend, and implements the Visitor
interface allowing it to
intercept invocations on VisitableCommand
s.
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
Field Summary | |
---|---|
protected Configuration |
configuration
|
protected Log |
log
|
protected boolean |
trace
|
Constructor Summary | |
---|---|
CommandInterceptor()
|
Method Summary | |
---|---|
CommandInterceptor |
getNext()
Retrieves the next interceptor in the chain. |
protected Object |
handleDefault(InvocationContext ctx,
VisitableCommand command)
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()
|
Object |
invokeNextInterceptor(InvocationContext ctx,
VisitableCommand command)
Invokes the next interceptor in the chain. |
void |
setNext(CommandInterceptor next)
Sets the next interceptor in the chain to the interceptor passed in. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Log log
protected boolean trace
protected Configuration configuration
Constructor Detail |
---|
public CommandInterceptor()
Method Detail |
---|
public final CommandInterceptor getNext()
public final boolean hasNext()
public final void setNext(CommandInterceptor next)
next
- next interceptor in the chain.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 invoke
Throwable
- in the event of problems
|
--> | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |