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
Direct Known Subclasses:
LegacyCacheStoreInterceptor

public class CacheStoreInterceptor
extends SkipCheckChainedInterceptor

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 7338 2008-12-19 15:25:58Z manik.surtani@jboss.com $
Author:
Bela Ban

Nested Class Summary
static class CacheStoreInterceptor.StoreModificationsBuilder
           
 
Field Summary
protected  TransactionManager txMgr
           
 
Fields inherited from class org.jboss.cache.interceptors.base.CommandInterceptor
configuration, log, trace
 
Constructor Summary
CacheStoreInterceptor()
           
 
Method Summary
 Map<String,Object> dumpStatistics()
           
 long getCacheLoaderStores()
           
 boolean getStatisticsEnabled()
           
protected  Object handleCommitCommand(InvocationContext ctx, CommitCommand command)
           
protected  Object handleMoveCommand(InvocationContext ctx, MoveCommand command)
           
protected  Object handleOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command)
           
protected  Object handlePrepareCommand(InvocationContext ctx, PrepareCommand command)
           
protected  Object handlePutDataMapCommand(InvocationContext ctx, PutDataMapCommand command)
           
protected  Object handlePutForExternalReadCommand(InvocationContext ctx, PutForExternalReadCommand command)
           
protected  Object handlePutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command)
           
protected  Object handleRemoveDataCommand(InvocationContext ctx, ClearDataCommand command)
           
protected  Object handleRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command)
           
protected  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.
protected  Object handleRollbackCommand(InvocationContext ctx, RollbackCommand command)
           
protected  void init(CacheLoaderManager loaderManager, TransactionManager txManager, CacheLoaderConfig clConfig)
           
protected  boolean inTransaction()
           
protected  CacheStoreInterceptor.StoreModificationsBuilder prepareCacheLoader(GlobalTransaction gtx, TransactionContext transactionContext, boolean onePhase)
           
 void resetStatistics()
           
 void setStatisticsEnabled(boolean enabled)
           
 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()
           
protected  void storeStateForPutDataMap(Fqn f, InvocationContext ctx)
           
 
Methods inherited from class org.jboss.cache.interceptors.base.SkipCheckChainedInterceptor
handleAll, handleDefault, handleEvictFqnCommand, handleExistsNodeCommand, handleGetChildrenNamesCommand, handleGetDataMapCommand, handleGetKeysCommand, handleGetKeyValueCommand, handleGetNodeCommand, handleGravitateDataCommand, handleInvalidateCommand, visitClearDataCommand, visitCommitCommand, visitEvictFqnCommand, visitExistsNodeCommand, visitGetChildrenNamesCommand, visitGetDataMapCommand, visitGetKeysCommand, visitGetKeyValueCommand, visitGetNodeCommand, visitGravitateDataCommand, visitInvalidateCommand, visitMoveCommand, visitOptimisticPrepareCommand, visitPrepareCommand, visitPutDataMapCommand, visitPutForExternalReadCommand, visitPutKeyValueCommand, visitRemoveKeyCommand, visitRemoveNodeCommand, visitRollbackCommand
 
Methods inherited from class org.jboss.cache.interceptors.base.CommandInterceptor
getNext, hasNext, invokeNextInterceptor, setNext
 
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
 

Field Detail

txMgr

protected TransactionManager txMgr
Constructor Detail

CacheStoreInterceptor

public CacheStoreInterceptor()
Method Detail

init

protected void init(CacheLoaderManager loaderManager,
                    TransactionManager txManager,
                    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

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

handleRollbackCommand

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

handleOptimisticPrepareCommand

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

handlePrepareCommand

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

handleRemoveNodeCommand

protected 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

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

handleRemoveDataCommand

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

handleMoveCommand

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

handlePutDataMapCommand

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

storeStateForPutDataMap

protected void storeStateForPutDataMap(Fqn f,
                                       InvocationContext ctx)
                                throws Exception
Throws:
Exception

handlePutKeyValueCommand

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

handlePutForExternalReadCommand

protected Object handlePutForExternalReadCommand(InvocationContext ctx,
                                                 PutForExternalReadCommand command)
                                          throws Throwable
Overrides:
handlePutForExternalReadCommand in class SkipCheckChainedInterceptor
Throws:
Throwable

inTransaction

protected boolean inTransaction()
                         throws SystemException
Throws:
SystemException

prepareCacheLoader

protected CacheStoreInterceptor.StoreModificationsBuilder prepareCacheLoader(GlobalTransaction gtx,
                                                                             TransactionContext transactionContext,
                                                                             boolean onePhase)
                                                                      throws Throwable
Throws:
Throwable

resetStatistics

public void resetStatistics()

dumpStatistics

public Map<String,Object> dumpStatistics()

getStatisticsEnabled

public boolean getStatisticsEnabled()

setStatisticsEnabled

public void setStatisticsEnabled(boolean enabled)

getCacheLoaderStores

public long getCacheLoaderStores()


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