org.infinispan.interceptors
Class InvalidationInterceptor

java.lang.Object
  extended by org.infinispan.commands.AbstractVisitor
      extended by org.infinispan.interceptors.base.CommandInterceptor
          extended by org.infinispan.interceptors.base.BaseRpcInterceptor
              extended by org.infinispan.interceptors.InvalidationInterceptor
All Implemented Interfaces:
Visitor

public class InvalidationInterceptor
extends BaseRpcInterceptor

This interceptor acts as a replacement to the replication interceptor when the CacheImpl is configured with ClusteredSyncMode as INVALIDATE.

The idea is that rather than replicating changes to all caches in a cluster when write methods are called, simply broadcast an InvalidateCommand on the remote caches containing all keys modified. This allows the remote cache to look up the value in a shared cache loader which would have been updated with the changes.

Since:
4.0
Author:
Manik Surtani, Galder ZamarreƱo, Mircea.Markus@jboss.com

Nested Class Summary
static class InvalidationInterceptor.InvalidationFilterVisitor
           
 
Field Summary
protected  Map<GlobalTransaction,List<VisitableCommand>> txMods
           
 
Fields inherited from class org.infinispan.interceptors.base.BaseRpcInterceptor
defaultSynchronous, rpcManager
 
Fields inherited from class org.infinispan.interceptors.base.CommandInterceptor
configuration
 
Constructor Summary
InvalidationInterceptor()
           
 
Method Summary
 long getInvalidations()
           
protected  Log getLog()
           
 boolean getStatisticsEnabled()
           
 void injectDependencies(CommandsFactory commandsFactory)
           
protected  Object invalidateAcrossCluster(boolean synchronous, InvocationContext ctx, Object[] keys, boolean useFuture, Object retvalForFuture)
           
 void resetStatistics()
           
 void setStatisticsEnabled(boolean enabled)
           
 Object visitClearCommand(InvocationContext ctx, ClearCommand command)
           
 Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command)
           
 Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command)
           
 Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command)
           
 Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command)
           
 Object visitReplaceCommand(InvocationContext ctx, ReplaceCommand command)
           
 
Methods inherited from class org.infinispan.interceptors.base.BaseRpcInterceptor
init, init, isLocalModeForced, isSynchronous, shouldInvokeRemoteTxCommand, visitLockControlCommand
 
Methods inherited from class org.infinispan.interceptors.base.CommandInterceptor
getNext, handleDefault, hasNext, invokeNextInterceptor, setNext
 
Methods inherited from class org.infinispan.commands.AbstractVisitor
visitApplyDeltaCommand, visitCollection, visitCommitCommand, visitDistributedExecuteCommand, visitEntrySetCommand, visitEvictCommand, visitGetKeyValueCommand, visitInvalidateCommand, visitInvalidateL1Command, visitKeySetCommand, visitRollbackCommand, visitSizeCommand, visitUnknownCommand, visitValuesCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

txMods

protected Map<GlobalTransaction,List<VisitableCommand>> txMods
Constructor Detail

InvalidationInterceptor

public InvalidationInterceptor()
Method Detail

getLog

protected Log getLog()
Overrides:
getLog in class CommandInterceptor

injectDependencies

public void injectDependencies(CommandsFactory commandsFactory)

visitPutKeyValueCommand

public Object visitPutKeyValueCommand(InvocationContext ctx,
                                      PutKeyValueCommand command)
                               throws Throwable
Specified by:
visitPutKeyValueCommand in interface Visitor
Overrides:
visitPutKeyValueCommand in class AbstractVisitor
Throws:
Throwable

visitReplaceCommand

public Object visitReplaceCommand(InvocationContext ctx,
                                  ReplaceCommand command)
                           throws Throwable
Specified by:
visitReplaceCommand in interface Visitor
Overrides:
visitReplaceCommand in class AbstractVisitor
Throws:
Throwable

visitRemoveCommand

public Object visitRemoveCommand(InvocationContext ctx,
                                 RemoveCommand command)
                          throws Throwable
Specified by:
visitRemoveCommand in interface Visitor
Overrides:
visitRemoveCommand in class AbstractVisitor
Throws:
Throwable

visitClearCommand

public Object visitClearCommand(InvocationContext ctx,
                                ClearCommand command)
                         throws Throwable
Specified by:
visitClearCommand in interface Visitor
Overrides:
visitClearCommand in class AbstractVisitor
Throws:
Throwable

visitPutMapCommand

public Object visitPutMapCommand(InvocationContext ctx,
                                 PutMapCommand command)
                          throws Throwable
Specified by:
visitPutMapCommand in interface Visitor
Overrides:
visitPutMapCommand in class AbstractVisitor
Throws:
Throwable

visitPrepareCommand

public Object visitPrepareCommand(TxInvocationContext ctx,
                                  PrepareCommand command)
                           throws Throwable
Specified by:
visitPrepareCommand in interface Visitor
Overrides:
visitPrepareCommand in class AbstractVisitor
Throws:
Throwable

invalidateAcrossCluster

protected Object invalidateAcrossCluster(boolean synchronous,
                                         InvocationContext ctx,
                                         Object[] keys,
                                         boolean useFuture,
                                         Object retvalForFuture)
                                  throws Throwable
Throws:
Throwable

resetStatistics

public void resetStatistics()

getStatisticsEnabled

public boolean getStatisticsEnabled()

setStatisticsEnabled

public void setStatisticsEnabled(boolean enabled)

getInvalidations

public long getInvalidations()

-->

Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.