org.jboss.cache.interceptors
Class PassivationInterceptor

java.lang.Object
  extended by org.jboss.cache.commands.AbstractVisitor
      extended by org.jboss.cache.interceptors.base.CommandInterceptor
          extended by org.jboss.cache.interceptors.PassivationInterceptor
All Implemented Interfaces:
Visitor, InterceptorMBean, PassivationInterceptorMBean

public class PassivationInterceptor
extends CommandInterceptor
implements PassivationInterceptorMBean

Writes evicted nodes back to the store on the way in through the CacheLoader, either before each method call (no TXs), or at TX commit.

Version:
$Id: PassivationInterceptor.java 5769 2008-04-30 12:00:36Z manik.surtani@jboss.com $
Author:
{Hany Mesha}

Field Summary
protected  CacheLoader loader
           
 
Fields inherited from class org.jboss.cache.interceptors.base.CommandInterceptor
configuration, log, trace
 
Constructor Summary
PassivationInterceptor()
           
 
Method Summary
 Map<String,Object> dumpStatistics()
          Returns a map of statistics.
 long getPassivations()
          Returns the number of cache node passivations
 void resetStatistics()
          Resets statistics gathered.
 void setDependencies(Notifier notifier, DataContainer dataContainer, CacheLoaderManager loaderManager)
           
 Object visitEvictFqnCommand(InvocationContext ctx, EvictCommand command)
          Notifies the cache instance listeners that the evicted node is about to be passivated and stores the evicted node and its attributes back to the store using the CacheLoader.
 
Methods inherited from class org.jboss.cache.interceptors.base.CommandInterceptor
getNext, getStatisticsEnabled, handleDefault, hasNext, invokeNextInterceptor, setNext, setStatisticsEnabled
 
Methods inherited from class org.jboss.cache.commands.AbstractVisitor
visitCollection, visitCommitCommand, visitCreateNodeCommand, visitExistsNodeCommand, visitGetChildrenNamesCommand, visitGetDataMapCommand, visitGetKeysCommand, visitGetKeyValueCommand, visitGetNodeCommand, visitGravitateDataCommand, visitInvalidateCommand, visitMoveCommand, visitOptimisticPrepareCommand, visitPrepareCommand, visitPutDataMapCommand, visitPutKeyValueCommand, visitRemoveDataCommand, visitRemoveKeyCommand, visitRemoveNodeCommand, visitRollbackCommand
 
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

loader

protected CacheLoader loader
Constructor Detail

PassivationInterceptor

public PassivationInterceptor()
Method Detail

setDependencies

public void setDependencies(Notifier notifier,
                            DataContainer dataContainer,
                            CacheLoaderManager loaderManager)

visitEvictFqnCommand

public Object visitEvictFqnCommand(InvocationContext ctx,
                                   EvictCommand command)
                            throws Throwable
Notifies the cache instance listeners that the evicted node is about to be passivated and stores the evicted node and its attributes back to the store using the CacheLoader.

Specified by:
visitEvictFqnCommand in interface Visitor
Overrides:
visitEvictFqnCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

getPassivations

public long getPassivations()
Description copied from interface: PassivationInterceptorMBean
Returns the number of cache node passivations

Specified by:
getPassivations in interface PassivationInterceptorMBean
Returns:
the number of cache node passivations

resetStatistics

public void resetStatistics()
Description copied from class: CommandInterceptor
Resets statistics gathered. Is a no-op, and should be overridden if it is to be meaningful.

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

dumpStatistics

public Map<String,Object> dumpStatistics()
Description copied from class: CommandInterceptor
Returns a map of statistics. This is a default implementation which returns an empty map and should be overridden if it is to be meaningful.

Specified by:
dumpStatistics in interface InterceptorMBean
Overrides:
dumpStatistics in class CommandInterceptor
Returns:
an empty map


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