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.92 2007/07/17 14:10:21 msurtani Exp $
Author:
Bela Ban

Field Summary
protected  boolean isActivation
           
protected  CacheLoader loader
           
protected  boolean useCacheStore
          True if CacheStoreInterceptor is in place.
 
Fields inherited from class org.jboss.cache.interceptors.Interceptor
cache, configuration, last, log, next
 
Constructor Summary
CacheLoaderInterceptor()
           
 
Method Summary
 java.util.Map<java.lang.String,java.lang.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  NodeSPI getNode(Fqn fqn)
          Retrieves a node from memory; doesn't access the cache loader
 java.lang.Object invoke(InvocationContext ctx)
          Makes sure a node is loaded into memory before a call executes (no-op if node is already loaded).
protected  void lock(Fqn fqn, NodeLock.LockType lock_type, boolean recursive)
           
 void resetStatistics()
          This implementation is a no-op.
 void setCache(CacheSPI cache)
           
 
Methods inherited from class org.jboss.cache.interceptors.Interceptor
getLast, getNext, getStatisticsEnabled, isActive, isOnePhaseCommitPrepareMehod, isPreparing, isValid, 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

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(CacheSPI cache)
Overrides:
setCache in class Interceptor

invoke

public java.lang.Object invoke(InvocationContext ctx)
                        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
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 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 java.util.Map<java.lang.String,java.lang.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 java.lang.Throwable
Throws:
java.lang.Throwable

getNode

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

Parameters:
fqn -