org.jboss.cache.interceptors
Class CacheLoaderInterceptor

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

public class CacheLoaderInterceptor
extends Interceptor
implements CacheLoaderInterceptorMBean

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

Version:
$Id: CacheLoaderInterceptor.java,v 1.40.2.9 2007/07/13 19:36:25 bstansberry Exp $
Author:
Bela Ban

Field Summary
protected  CacheLoader loader
           
protected  boolean useCacheStore
          True if CacheStoreInterceptor is in place.
 
Constructor Summary
CacheLoaderInterceptor()
           
 
Method Summary
 java.util.Map dumpStatistics()
          Returns a map of the cache interceptor's statistics Map elements consist of {String name, Object value} entries
 long getCacheLoaderLoads()
          Returns the number of cache loader node loads
 long getCacheLoaderMisses()
          Returns the number of cache loader node misses
protected  DataNode getNode(Fqn fqn)
          Retrieves a node from memory; doesn't access the cache loader
 java.lang.Object invoke(org.jgroups.blocks.MethodCall call)
          Makes sure a node is loaded into memory before a call executes (no-op if node is already loaded).
protected  void lock(Fqn fqn, int lock_type, boolean recursive)
           
 void resetStatistics()
          Resets an interceptor's cache statistics
 void setCache(TreeCache cache)
           
 
Methods inherited from class org.jboss.cache.interceptors.Interceptor
getInvocationContext, getNext, getStatisticsEnabled, isActive, isBuddyGroupOrganisationMethod, isOnePhaseCommitPrepareMehod, isPreparing, isTransactionLifecycleMethod, isValid, setInvocationContext, setNext, setStatisticsEnabled
 
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

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

setCache

public void setCache(TreeCache cache)
Overrides:
setCache in class Interceptor

invoke

public java.lang.Object invoke(org.jgroups.blocks.MethodCall call)
                        throws java.lang.Throwable
Makes sure a node is loaded into memory before a call executes (no-op if node is already loaded). If attributes of a node are to be accessed by the method, the attributes are also loaded.

Overrides:
invoke in class Interceptor
Parameters:
call -
Returns:
Throws:
java.lang.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 interface: InterceptorMBean
Resets an interceptor's cache statistics

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

dumpStatistics

public java.util.Map dumpStatistics()
Description copied from interface: InterceptorMBean
Returns a map of the cache interceptor's statistics Map elements consist of {String name, Object value} entries

Specified by:
dumpStatistics in interface InterceptorMBean
Overrides:
dumpStatistics in class Interceptor
Returns:
a map containing statistics

lock

protected void lock(Fqn fqn,
                    int lock_type,
                    boolean recursive)
             throws java.lang.Throwable
Throws:
java.lang.Throwable

getNode

protected DataNode getNode(Fqn fqn)
Retrieves a node from memory; doesn't access the cache loader

Parameters:
fqn -


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.