org.jboss.cache.interceptors
Class InvalidationInterceptor

java.lang.Object
  extended by org.jboss.cache.interceptors.Interceptor
      extended by org.jboss.cache.interceptors.BaseRpcInterceptor
          extended by 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 TreeCache 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)

Field Summary
protected  TransactionTable txTable
           
 
Constructor Summary
InvalidationInterceptor()
           
 
Method Summary
 java.util.Map dumpStatistics()
          Returns a map of the cache interceptor's statistics Map elements consist of {String name, Object value} entries
protected  Fqn findFqn(java.lang.Object[] objects)
           
 long getInvalidations()
          Returns the number of cache invalidations
protected  TransactionWorkspace getWorkspace(GlobalTransaction gtx)
           
protected  void invalidateAcrossCluster(Fqn fqn, TransactionWorkspace workspace)
           
protected  void invalidateModifications(java.util.List modifications, TransactionWorkspace workspace)
           
 java.lang.Object invoke(org.jgroups.blocks.MethodCall call)
           
protected  java.util.Iterator optimisedIterator(java.util.List list)
          Removes non-crud methods, plus clobs together common calls to Fqn's.
 void resetStatistics()
          Resets an interceptor's cache statistics
 void setCache(TreeCache cache)
           
 
Methods inherited from class org.jboss.cache.interceptors.BaseRpcInterceptor
checkResponses, containsModifications, putCallOnAsyncReplicationQueue, replicateCall, replicateCall
 
Methods inherited from class org.jboss.cache.interceptors.Interceptor
getInvocationContext, getNext, getStatisticsEnabled, isActive, isBuddyGroupOrganisationMethod, isOnePhaseCommitPrepareMehod, isPreparing, isTransactionLifecycleMethod, isValid, setInvocationContext, setNext, setStatisticsEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.cache.interceptors.InterceptorMBean
getStatisticsEnabled, setStatisticsEnabled
 

Field Detail

txTable

protected TransactionTable txTable
Constructor Detail

InvalidationInterceptor

public InvalidationInterceptor()
Method Detail

setCache

public void setCache(TreeCache cache)
Overrides:
setCache in class BaseRpcInterceptor

invoke

public java.lang.Object invoke(org.jgroups.blocks.MethodCall call)
                        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 interface: InterceptorMBean
Resets an interceptor's cache statistics

Specified by:
resetStatistics in interface InterceptorMBean
Overrides:
resetStatistics in class Interceptor

dumpStatistics

public java.util.Map dumpStatistics()
Description copied from interface: InterceptorMBean
Returns a map of the cache interceptor's statistics Map elements consist of {String name, Object value} entries

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 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.Iterator optimisedIterator(java.util.List 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


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.