org.jboss.cache.interceptors
Class CacheLoaderInterceptor

java.lang.Object
  extended by org.jboss.cache.interceptors.Interceptor
      extended by org.jboss.cache.interceptors.MethodDispacherInterceptor
          extended by org.jboss.cache.interceptors.CacheLoaderInterceptor
All Implemented Interfaces:
CacheLoaderInterceptorMBean, InterceptorMBean
Direct Known Subclasses:
ActivationInterceptor

public class CacheLoaderInterceptor
extends MethodDispacherInterceptor
implements CacheLoaderInterceptorMBean

Loads nodes that don't exist at the time of the call into memory from the CacheLoader

Version:
$Id: CacheLoaderInterceptor.java 4986 2008-01-04 16:55:01Z manik.surtani@jboss.com $
Author:
Bela Ban

Field Summary
protected  CacheLoaderManager clm
           
protected  boolean isActivation
           
protected  CacheLoader loader
           
protected  boolean useCacheStore
          True if CacheStoreInterceptor is in place.
protected  boolean usingOptimisticInvalidation
           
 
Fields inherited from class org.jboss.cache.interceptors.Interceptor
cache, configuration, last, log, next, trace
 
Constructor Summary
CacheLoaderInterceptor()
           
 
Method Summary
 Map<String,Object> dumpStatistics()
          This implementation returns an empty Map.
 long getCacheLoaderLoads()
          Returns the number of cache loader node loads
 long getCacheLoaderMisses()
          Returns the number of cache loader node misses
protected  Object handleAddChildMethod(InvocationContext ctx, GlobalTransaction tx, Fqn parentFqn, Object childName, Node cn, boolean createUndoOps)
          Handles CacheImpl._addChild(org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, Object, org.jboss.cache.Node, boolean)
protected  Object handleGetDataMapMethod(InvocationContext ctx, Fqn fqn)
          Handles CacheImpl._getData(org.jboss.cache.Fqn)
protected  Object handleGetChildrenNamesMethod(InvocationContext ctx, Fqn fqn)
          Handles CacheImpl._getChildrenNames(org.jboss.cache.Fqn)
protected  Object handleGetKeysMethod(InvocationContext ctx, Fqn fqn)
          Handles Cache.getKeys(Fqn)
protected  Object handleGetKeyValueMethod(InvocationContext ctx, Fqn fqn, Object key, boolean sendNodeEvent)
          Handles CacheImpl._get(org.jboss.cache.Fqn, Object, boolean)
protected  Object handleGetNodeMethod(InvocationContext ctx, Fqn fqn)
          Handles CacheImpl._get(org.jboss.cache.Fqn)
protected  Object handleMoveMethod(InvocationContext ctx, Fqn from, Fqn to)
          Handles CacheImpl._move(org.jboss.cache.Fqn, org.jboss.cache.Fqn)
protected  Object handlePrintMethod(InvocationContext ctx, Fqn fqn)
          Handles CacheImpl._print(org.jboss.cache.Fqn)
protected  Object handlePutDataEraseMethod(InvocationContext ctx, GlobalTransaction gt, Fqn fqn, Map newData, boolean createUndoOps, boolean eraseContents)
          Handles CacheImpl._put(org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, java.util.Map, boolean, boolean)
protected  Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Map data, boolean createUndoOps)
          Handles CacheImpl._put(org.jboss.cache.transaction.GlobalTransaction, String, java.util.Map, boolean)
protected  Object handlePutForExternalReadMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Object key, Object value)
          Handles CacheImpl._putForExternalRead(org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, Object, Object)
protected  Object handlePutKeyValueMethod(InvocationContext ctx, GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps)
          Handles CacheImpl._put(org.jboss.cache.transaction.GlobalTransaction, String, Object, Object, boolean)
protected  Object handleReleaseAllLocksMethod(InvocationContext ctx, Fqn fqn)
          Handles CacheImpl._releaseAllLocks(org.jboss.cache.Fqn)
protected  Object handleRemoveDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, boolean createUndoOps)
          Handles CacheImpl._removeData(org.jboss.cache.transaction.GlobalTransaction, Fqn, boolean)
protected  Object handleRemoveKeyMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Object key, boolean createUndoOps)
          Handles CacheImpl._remove(org.jboss.cache.transaction.GlobalTransaction, String, Object, boolean)
protected  Object handleRemoveNodeMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, boolean createUndoOps)
          Handles CacheImpl._remove(org.jboss.cache.transaction.GlobalTransaction, String, boolean)
protected  Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction globalTransaction)
          Handles CacheImpl.rollback(org.jboss.cache.transaction.GlobalTransaction)
protected  void injectDependencies(TransactionTable txTable, CacheLoaderManager clm, Configuration configuration)
           
protected  void lock(Fqn fqn, NodeLock.LockType lock_type, boolean recursive)
           
 void resetStatistics()
          This implementation is a no-op.
protected  void startInterceptor()
           
 
Methods inherited from class org.jboss.cache.interceptors.MethodDispacherInterceptor
handleBlockChannelMethod, handleCommitMethod, handleDataGravitationCleanupMethod, handleEvictMethod, handleEvictVersionedNodeMethod, handleExistsMethod, handleLockMethod, handleOptimisticPrepareMethod, handlePrepareMethod, handlePutDataEraseVersionedMethod, handlePutDataVersionedMethod, handlePutForExternalReadVersionedMethod, handlePutKeyValueVersionedMethod, handleRemoveDataVersionedMethod, handleRemoveKeyVersionedMethod, handleRemoveNodeVersionedMethod, handleUnblockChannelMethod, invoke, skipMethodCall
 
Methods inherited from class org.jboss.cache.interceptors.Interceptor
assertTransactionValid, getLast, getNext, getStatisticsEnabled, initLogger, isActive, isPreparing, isValid, nextInterceptor, peekNode, setCache, setLast, setNext, setStatisticsEnabled, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.cache.interceptors.InterceptorMBean
getStatisticsEnabled, setStatisticsEnabled
 

Field Detail

isActivation

protected boolean isActivation

loader

protected CacheLoader loader

clm

protected CacheLoaderManager clm

usingOptimisticInvalidation

protected boolean usingOptimisticInvalidation

useCacheStore

protected boolean useCacheStore
True if CacheStoreInterceptor is in place. This allows us to skip loading keys for remove(Fqn, key) and put(Fqn, key). It also affects removal of node data and listing children.

Constructor Detail

CacheLoaderInterceptor

public CacheLoaderInterceptor()
Method Detail

injectDependencies

protected void injectDependencies(TransactionTable txTable,
                                  CacheLoaderManager clm,
                                  Configuration configuration)

startInterceptor

protected void startInterceptor()

handlePutDataEraseMethod

protected Object handlePutDataEraseMethod(InvocationContext ctx,
                                          GlobalTransaction gt,
                                          Fqn fqn,
                                          Map newData,
                                          boolean createUndoOps,
                                          boolean eraseContents)
                                   throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._put(org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, java.util.Map, boolean, boolean)

Overrides:
handlePutDataEraseMethod in class MethodDispacherInterceptor
Throws:
Throwable

handlePutDataMethod

protected Object handlePutDataMethod(InvocationContext ctx,
                                     GlobalTransaction tx,
                                     Fqn fqn,
                                     Map data,
                                     boolean createUndoOps)
                              throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._put(org.jboss.cache.transaction.GlobalTransaction, String, java.util.Map, boolean)

Overrides:
handlePutDataMethod in class MethodDispacherInterceptor
Throws:
Throwable

handlePutForExternalReadMethod

protected Object handlePutForExternalReadMethod(InvocationContext ctx,
                                                GlobalTransaction tx,
                                                Fqn fqn,
                                                Object key,
                                                Object value)
                                         throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._putForExternalRead(org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, Object, Object)

Overrides:
handlePutForExternalReadMethod in class MethodDispacherInterceptor
Throws:
Throwable

handlePutKeyValueMethod

protected Object handlePutKeyValueMethod(InvocationContext ctx,
                                         GlobalTransaction gtx,
                                         Fqn fqn,
                                         Object key,
                                         Object value,
                                         boolean createUndoOps)
                                  throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._put(org.jboss.cache.transaction.GlobalTransaction, String, Object, Object, boolean)

Overrides:
handlePutKeyValueMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleMoveMethod

protected Object handleMoveMethod(InvocationContext ctx,
                                  Fqn from,
                                  Fqn to)
                           throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._move(org.jboss.cache.Fqn, org.jboss.cache.Fqn)

Overrides:
handleMoveMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleAddChildMethod

protected Object handleAddChildMethod(InvocationContext ctx,
                                      GlobalTransaction tx,
                                      Fqn parentFqn,
                                      Object childName,
                                      Node cn,
                                      boolean createUndoOps)
                               throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._addChild(org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, Object, org.jboss.cache.Node, boolean)

Overrides:
handleAddChildMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleGetKeyValueMethod

protected Object handleGetKeyValueMethod(InvocationContext ctx,
                                         Fqn fqn,
                                         Object key,
                                         boolean sendNodeEvent)
                                  throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._get(org.jboss.cache.Fqn, Object, boolean)

Overrides:
handleGetKeyValueMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleGetNodeMethod

protected Object handleGetNodeMethod(InvocationContext ctx,
                                     Fqn fqn)
                              throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._get(org.jboss.cache.Fqn)

Overrides:
handleGetNodeMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleGetChildrenNamesMethod

protected Object handleGetChildrenNamesMethod(InvocationContext ctx,
                                              Fqn fqn)
                                       throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._getChildrenNames(org.jboss.cache.Fqn)

Overrides:
handleGetChildrenNamesMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleReleaseAllLocksMethod

protected Object handleReleaseAllLocksMethod(InvocationContext ctx,
                                             Fqn fqn)
                                      throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._releaseAllLocks(org.jboss.cache.Fqn)

Overrides:
handleReleaseAllLocksMethod in class MethodDispacherInterceptor
Throws:
Throwable

handlePrintMethod

protected Object handlePrintMethod(InvocationContext ctx,
                                   Fqn fqn)
                            throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._print(org.jboss.cache.Fqn)

Overrides:
handlePrintMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleGetKeysMethod

protected Object handleGetKeysMethod(InvocationContext ctx,
                                     Fqn fqn)
                              throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles Cache.getKeys(Fqn)

Overrides:
handleGetKeysMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleGetDataMapMethod

protected Object handleGetDataMapMethod(InvocationContext ctx,
                                        Fqn fqn)
                                 throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._getData(org.jboss.cache.Fqn)

Overrides:
handleGetDataMapMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleRollbackMethod

protected Object handleRollbackMethod(InvocationContext ctx,
                                      GlobalTransaction globalTransaction)
                               throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl.rollback(org.jboss.cache.transaction.GlobalTransaction)

Overrides:
handleRollbackMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleRemoveNodeMethod

protected Object handleRemoveNodeMethod(InvocationContext ctx,
                                        GlobalTransaction tx,
                                        Fqn fqn,
                                        boolean createUndoOps)
                                 throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._remove(org.jboss.cache.transaction.GlobalTransaction, String, boolean)

Overrides:
handleRemoveNodeMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleRemoveKeyMethod

protected Object handleRemoveKeyMethod(InvocationContext ctx,
                                       GlobalTransaction tx,
                                       Fqn fqn,
                                       Object key,
                                       boolean createUndoOps)
                                throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._remove(org.jboss.cache.transaction.GlobalTransaction, String, Object, boolean)

Overrides:
handleRemoveKeyMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleRemoveDataMethod

protected Object handleRemoveDataMethod(InvocationContext ctx,
                                        GlobalTransaction tx,
                                        Fqn fqn,
                                        boolean createUndoOps)
                                 throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._removeData(org.jboss.cache.transaction.GlobalTransaction, Fqn, boolean)

Overrides:
handleRemoveDataMethod in class MethodDispacherInterceptor
Throws:
Throwable

getCacheLoaderLoads

public long getCacheLoaderLoads()
Description copied from interface: CacheLoaderInterceptorMBean
Returns the number of cache loader node loads

Specified by:
getCacheLoaderLoads in interface CacheLoaderInterceptorMBean
Returns:
the number of cache loader node loads

getCacheLoaderMisses

public long getCacheLoaderMisses()
Description copied from interface: CacheLoaderInterceptorMBean
Returns the number of cache loader node misses

Specified by:
getCacheLoaderMisses in interface CacheLoaderInterceptorMBean
Returns:
the number of cache loader node misses

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 Map<String,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

lock

protected void lock(Fqn fqn,
                    NodeLock.LockType lock_type,
                    boolean recursive)
             throws Throwable
Throws:
Throwable


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