org.infinispan.loaders
Class AbstractCacheLoader

java.lang.Object
  extended by org.infinispan.loaders.AbstractCacheLoader
All Implemented Interfaces:
CacheLoader
Direct Known Subclasses:
AbstractCacheStore, ClusterCacheLoader

public abstract class AbstractCacheLoader
extends Object
implements CacheLoader

An abstract CacheLoader that holds common implementations for some methods

Since:
4.0
Author:
Manik Surtani, Mircea.Markus@jboss.com

Field Summary
protected  Cache cache
           
protected  StreamingMarshaller marshaller
           
 
Constructor Summary
AbstractCacheLoader()
           
 
Method Summary
 boolean containsKey(Object key)
           This implementation delegates to CacheLoader.load(Object), to ensure that a response is returned only if the entry is not expired.
 void init(CacheLoaderConfig config, Cache<?,?> cache, StreamingMarshaller m)
          Used to initialize a cache loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.infinispan.loaders.CacheLoader
getConfigurationClass, load, load, loadAll, loadAllKeys, start, stop
 

Field Detail

marshaller

protected volatile StreamingMarshaller marshaller

cache

protected volatile Cache cache
Constructor Detail

AbstractCacheLoader

public AbstractCacheLoader()
Method Detail

containsKey

public boolean containsKey(Object key)
                    throws CacheLoaderException
This implementation delegates to CacheLoader.load(Object), to ensure that a response is returned only if the entry is not expired.

Specified by:
containsKey in interface CacheLoader
Parameters:
key - key to test
Returns:
true if the key exists, false otherwise
Throws:
CacheLoaderException - in the event of problems reading from source

init

public void init(CacheLoaderConfig config,
                 Cache<?,?> cache,
                 StreamingMarshaller m)
          throws CacheLoaderException
Description copied from interface: CacheLoader
Used to initialize a cache loader. Typically invoked by the CacheLoaderManager when setting up cache loaders.

Specified by:
init in interface CacheLoader
Parameters:
config - the cache loader configuration bean
cache - cache associated with this cache loader. Implementations may use this to determine cache name when selecting where refer to state in storage, for example, a different database table name.
m - marshaller to use when loading state from a stream, if supported by the implementation.
Throws:
CacheLoaderException

-->

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