org.jboss.cache.interceptors
Class CacheStoreInterceptor

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

public class CacheStoreInterceptor
extends SkipCheckChainedInterceptor
implements CacheStoreInterceptorMBean

Writes modifications back to the store on the way out: stores modifications back through the CacheLoader, either after each method call (no TXs), or at TX commit.

Version:
$Id: CacheStoreInterceptor.java 5769 2008-04-30 12:00:36Z manik.surtani@jboss.com $
Author:
Bela Ban

Nested Class Summary
static class CacheStoreInterceptor.StoreModificationsBuilder
           
 
Field Summary
 
Fields inherited from class org.jboss.cache.interceptors.base.CommandInterceptor
configuration, log, trace
 
Constructor Summary
CacheStoreInterceptor()
           
 
Method Summary
 Map<String,Object> dumpStatistics()
          Returns a map of statistics.
 long getCacheLoaderStores()
          Returns the number of cache loader stores
 Object handleCommitCommand(InvocationContext ctx, CommitCommand command)
           
 Object handleMoveCommand(InvocationContext ctx, MoveCommand command)
           
 Object handleOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command)
           
 Object handlePrepareCommand(InvocationContext ctx, PrepareCommand command)
           
 Object handlePutDataMapCommand(InvocationContext ctx, PutDataMapCommand command)
           
 Object handlePutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command)
           
 Object handleRemoveDataCommand(InvocationContext ctx, RemoveDataCommand command)
           
 Object handleRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command)
           
 Object handleRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command)
          remove() methods need to be applied to the CacheLoader before passing up the call: a listener might access an element just removed, causing the CacheLoader to *load* the element before *removing* it.
 Object handleRollbackCommand(InvocationContext ctx, RollbackCommand command)
           
protected  void init(DataContainer dataContainer, CacheLoaderManager loaderManager, TransactionManager txManager, TransactionTable txTable, CacheLoaderConfig clConfig)
           
 void resetStatistics()
          Resets statistics gathered.
 boolean skipInterception(InvocationContext ctx, VisitableCommand command)
          if this is a shared cache loader and the call is of remote origin, pass up the chain
protected  void start()
           
 
Methods inherited from class org.jboss.cache.interceptors.base.SkipCheckChainedInterceptor
handleAll, handleDefault, handleEvictFqnCommand, handleExistsNodeCommand, handleGetChildrenNamesCommand, handleGetDataMapCommand, handleGetKeysCommand, handleGetKeyValueCommand, handleGetNodeCommand, handleGravitateDataCommand, handleInvalidateCommand, visitCommitCommand, visitEvictFqnCommand, visitExistsNodeCommand, visitGetChildrenNamesCommand, visitGetDataMapCommand, visitGetKeysCommand, visitGetKeyValueCommand, visitGetNodeCommand, visitGravitateDataCommand, visitInvalidateCommand, visitMoveCommand, visitOptimisticPrepareCommand, visitPrepareCommand, visitPutDataMapCommand, visitPutKeyValueCommand, visitRemoveDataCommand, visitRemoveKeyCommand, visitRemoveNodeCommand, visitRollbackCommand
 
Methods inherited from class org.jboss.cache.interceptors.base.CommandInterceptor
getNext, getStatisticsEnabled, hasNext, invokeNextInterceptor, setNext, setStatisticsEnabled
 
Methods inherited from class org.jboss.cache.commands.AbstractVisitor
visitCollection, visitCreateNodeCommand
 
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
 

Constructor Detail

CacheStoreInterceptor

public CacheStoreInterceptor()
Method Detail

init

protected void init(DataContainer dataContainer,
                    CacheLoaderManager loaderManager,
                    TransactionManager txManager,
                    TransactionTable txTable,
                    CacheLoaderConfig clConfig)

start

protected void start()

skipInterception

public boolean skipInterception(InvocationContext ctx,
                                VisitableCommand command)
if this is a shared cache loader and the call is of remote origin, pass up the chain

Specified by:
skipInterception in class SkipCheckChainedInterceptor
Parameters:
ctx - invocation context
command - command
Returns:
true if the invocation should skip the current interceptor and move on to the next in the chain, false otherwise.

handleCommitCommand

public Object handleCommitCommand(InvocationContext ctx,
                                  CommitCommand command)
                           throws Throwable
Overrides:
handleCommitCommand in class SkipCheckChainedInterceptor
Throws:
Throwable

handleRollbackCommand

public Object handleRollbackCommand(InvocationContext ctx,
                                    RollbackCommand command)
                             throws Throwable
Overrides:
handleRollbackCommand in class SkipCheckChainedInterceptor
Throws:
Throwable

handleOptimisticPrepareCommand

public Object handleOptimisticPrepareCommand(InvocationContext ctx,
                                             OptimisticPrepareCommand command)
                                      throws Throwable
Overrides:
handleOptimisticPrepareCommand in class SkipCheckChainedInterceptor
Throws:
Throwable

handlePrepareCommand

public Object handlePrepareCommand(InvocationContext ctx,
                                   PrepareCommand command)
                            throws Throwable
Overrides:
handlePrepareCommand in class SkipCheckChainedInterceptor
Throws:
Throwable

handleRemoveNodeCommand

public Object handleRemoveNodeCommand(InvocationContext ctx,
                                      RemoveNodeCommand command)
                               throws Throwable
remove() methods need to be applied to the CacheLoader before passing up the call: a listener might access an element just removed, causing the CacheLoader to *load* the element before *removing* it.

Overrides:
handleRemoveNodeCommand in class SkipCheckChainedInterceptor
Throws:
Throwable

handleRemoveKeyCommand

public Object handleRemoveKeyCommand(InvocationContext ctx,
                                     RemoveKeyCommand command)
                              throws Throwable
Overrides:
handleRemoveKeyCommand in class SkipCheckChainedInterceptor
Throws:
Throwable

handleRemoveDataCommand

public Object handleRemoveDataCommand(InvocationContext ctx,
                                      RemoveDataCommand command)
                               throws Throwable
Overrides:
handleRemoveDataCommand in class SkipCheckChainedInterceptor
Throws:
Throwable

handleMoveCommand

public Object handleMoveCommand(InvocationContext ctx,
                                MoveCommand command)
                         throws Throwable
Overrides:
handleMoveCommand in class SkipCheckChainedInterceptor
Throws:
Throwable

handlePutDataMapCommand

public Object handlePutDataMapCommand(InvocationContext ctx,
                                      PutDataMapCommand command)
                               throws Throwable
Overrides:
handlePutDataMapCommand in class SkipCheckChainedInterceptor
Throws:
Throwable

handlePutKeyValueCommand

public Object handlePutKeyValueCommand(InvocationContext ctx,
                                       PutKeyValueCommand command)
                                throws Throwable
Overrides:
handlePutKeyValueCommand in class SkipCheckChainedInterceptor
Throws:
Throwable

getCacheLoaderStores

public long getCacheLoaderStores()
Description copied from interface: CacheStoreInterceptorMBean
Returns the number of cache loader stores

Specified by:
getCacheLoaderStores in interface CacheStoreInterceptorMBean
Returns:
the number of cache loader stores

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.