org.jboss.cache.interceptors
Class ActivationInterceptor

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

public class ActivationInterceptor
extends CacheLoaderInterceptor
implements ActivationInterceptorMBean

Loads nodes that don't exist at the time of the call into memory from the CacheLoader. If the nodes were evicted earlier then we remove them from the cache loader after their attributes have been initialized and their children have been loaded in memory.

Version:
$Id: ActivationInterceptor.java 4986 2008-01-04 16:55:01Z manik.surtani@jboss.com $
Author:
{Hany Mesha}

Field Summary
protected static Object NULL
           
protected  ConcurrentHashMap transactions
          List that we have registered for
protected  TransactionManager tx_mgr
           
protected  TransactionTable tx_table
           
 
Fields inherited from class org.jboss.cache.interceptors.CacheLoaderInterceptor
clm, isActivation, loader, useCacheStore, usingOptimisticInvalidation
 
Fields inherited from class org.jboss.cache.interceptors.Interceptor
cache, configuration, last, log, next, trace
 
Constructor Summary
ActivationInterceptor()
           
 
Method Summary
 Map<String,Object> dumpStatistics()
          This implementation returns an empty Map.
 long getActivations()
          Returns the number of cache node activations
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 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 handleOptimisticPrepareMethod(InvocationContext ctx, GlobalTransaction gtx, List modifications, Map data, org.jgroups.Address address, boolean onePhaseCommit)
          Handles CacheImpl.optimisticPrepare(org.jboss.cache.transaction.GlobalTransaction, java.util.List, java.util.Map, org.jgroups.Address, boolean)
protected  Object handlePrepareMethod(InvocationContext ctx, GlobalTransaction gtx, List modification, org.jgroups.Address coordinator, boolean onePhaseCommit)
          Handles CacheImpl.prepare(org.jboss.cache.transaction.GlobalTransaction, java.util.List, org.jgroups.Address, boolean)
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)
 void resetStatistics()
          This implementation is a no-op.
 
Methods inherited from class org.jboss.cache.interceptors.CacheLoaderInterceptor
getCacheLoaderLoads, getCacheLoaderMisses, handleGetDataMapMethod, handleMoveMethod, handleRollbackMethod, injectDependencies, lock, startInterceptor
 
Methods inherited from class org.jboss.cache.interceptors.MethodDispacherInterceptor
handleBlockChannelMethod, handleCommitMethod, handleDataGravitationCleanupMethod, handleEvictMethod, handleEvictVersionedNodeMethod, handleExistsMethod, handleLockMethod, 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.CacheLoaderInterceptorMBean
getCacheLoaderLoads, getCacheLoaderMisses
 
Methods inherited from interface org.jboss.cache.interceptors.InterceptorMBean
getStatisticsEnabled, setStatisticsEnabled
 

Field Detail

tx_mgr

protected TransactionManager tx_mgr

tx_table

protected TransactionTable tx_table

transactions

protected ConcurrentHashMap transactions
List that we have registered for


NULL

protected static final Object NULL
Constructor Detail

ActivationInterceptor

public ActivationInterceptor()
Method Detail

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 CacheLoaderInterceptor
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 CacheLoaderInterceptor
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 CacheLoaderInterceptor
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 CacheLoaderInterceptor
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 CacheLoaderInterceptor
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 CacheLoaderInterceptor
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 CacheLoaderInterceptor
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 CacheLoaderInterceptor
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 CacheLoaderInterceptor
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 CacheLoaderInterceptor
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 CacheLoaderInterceptor
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 CacheLoaderInterceptor
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 CacheLoaderInterceptor
Throws:
Throwable

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 CacheLoaderInterceptor
Throws:
Throwable

handleOptimisticPrepareMethod

protected Object handleOptimisticPrepareMethod(InvocationContext ctx,
                                               GlobalTransaction gtx,
                                               List modifications,
                                               Map data,
                                               org.jgroups.Address address,
                                               boolean onePhaseCommit)
                                        throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl.optimisticPrepare(org.jboss.cache.transaction.GlobalTransaction, java.util.List, java.util.Map, org.jgroups.Address, boolean)

Overrides:
handleOptimisticPrepareMethod in class MethodDispacherInterceptor
Throws:
Throwable

handlePrepareMethod

protected Object handlePrepareMethod(InvocationContext ctx,
                                     GlobalTransaction gtx,
                                     List modification,
                                     org.jgroups.Address coordinator,
                                     boolean onePhaseCommit)
                              throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl.prepare(org.jboss.cache.transaction.GlobalTransaction, java.util.List, org.jgroups.Address, boolean)

Overrides:
handlePrepareMethod in class MethodDispacherInterceptor
Throws:
Throwable

getActivations

public long getActivations()
Description copied from interface: ActivationInterceptorMBean
Returns the number of cache node activations

Specified by:
getActivations in interface ActivationInterceptorMBean
Returns:
the number of cache node activations

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 CacheLoaderInterceptor

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 CacheLoaderInterceptor
Returns:
a map containing statistics


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