org.jboss.cache.interceptors
Class InvalidationInterceptor
java.lang.Object
org.jboss.cache.interceptors.Interceptor
org.jboss.cache.interceptors.BaseRpcInterceptor
org.jboss.cache.interceptors.InvalidationInterceptor
- All Implemented Interfaces:
- InterceptorMBean, InvalidationInterceptorMBean
public class InvalidationInterceptor
- extends BaseRpcInterceptor
- implements InvalidationInterceptorMBean
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 CRUD (Create, Remove, Update, Delete) methods are called, simply call
evict(Fqn) on the remote caches for each changed node. This allows the
remote node to look up the value in a shared cache loader which would have
been updated with the changes.
- Author:
- Manik Surtani (manik@jboss.org)
Methods inherited from class org.jboss.cache.interceptors.Interceptor |
getLast, getNext, getStatisticsEnabled, isActive, isOnePhaseCommitPrepareMehod, isPreparing, isValid, setLast, setNext, setStatisticsEnabled, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
txTable
protected TransactionTable txTable
InvalidationInterceptor
public InvalidationInterceptor()
setCache
public void setCache(CacheSPI cache)
- Overrides:
setCache
in class BaseRpcInterceptor
invoke
public java.lang.Object invoke(InvocationContext ctx)
throws java.lang.Throwable
- Overrides:
invoke
in class Interceptor
- Throws:
java.lang.Throwable
getInvalidations
public long getInvalidations()
- Description copied from interface:
InvalidationInterceptorMBean
- Returns the number of cache invalidations
- Specified by:
getInvalidations
in interface InvalidationInterceptorMBean
- Returns:
- the number of invalidations
resetStatistics
public void resetStatistics()
- Description copied from class:
Interceptor
- This implementation is a no-op. If individual Interceptors wish to expose statistics, they can override this
method.
- Specified by:
resetStatistics
in interface InterceptorMBean
- Overrides:
resetStatistics
in class Interceptor
dumpStatistics
public java.util.Map<java.lang.String,java.lang.Object> dumpStatistics()
- Description copied from class:
Interceptor
- This implementation returns an empty Map. If individual Interceptors wish to expose statistics, they can override this
method.
- Specified by:
dumpStatistics
in interface InterceptorMBean
- Overrides:
dumpStatistics
in class Interceptor
- Returns:
- a map containing statistics
invalidateAcrossCluster
protected void invalidateAcrossCluster(Fqn fqn,
TransactionWorkspace workspace)
throws java.lang.Throwable
- Throws:
java.lang.Throwable
invalidateModifications
protected void invalidateModifications(java.util.List<MethodCall> modifications,
TransactionWorkspace workspace)
throws java.lang.Throwable
- Throws:
java.lang.Throwable
getWorkspace
protected TransactionWorkspace getWorkspace(GlobalTransaction gtx)
findFqn
protected Fqn findFqn(java.lang.Object[] objects)
optimisedIterator
protected java.util.Set<Fqn> optimisedIterator(java.util.List<MethodCall> list)
- Removes non-crud methods, plus clobs together common calls to Fqn's.
E.g, if we have put("/a/b", "1", "2") followed by a put("/a/b", "3",
"4") we should only evict "/a/b" once.
- Parameters:
list
-
- Returns:
- Iterator containing a unique set of Fqns of crud methods in this tx