org.infinispan.loaders.cluster
Class ClusterCacheLoader

java.lang.Object
  extended by org.infinispan.loaders.AbstractCacheLoader
      extended by org.infinispan.loaders.cluster.ClusterCacheLoader
All Implemented Interfaces:
CacheLoader

public class ClusterCacheLoader
extends AbstractCacheLoader

Cache loader that consults other members in the cluster for values. A timeout property is required, a long that specifies in milliseconds how long to wait for results before returning a null.

Author:
Mircea.Markus@jboss.com

Constructor Summary
ClusterCacheLoader()
           
 
Method Summary
 Class<? extends CacheLoaderConfig> getConfigurationClass()
           
 void init(CacheLoaderConfig config, Cache cache, Marshaller m)
          Used to initialize a cache loader.
protected  boolean isCacheReady()
          A test to check whether the cache is in its started state.
 InternalCacheEntry load(Object key)
          Loads an entry mapped to by a given key.
 Set<InternalCacheEntry> loadAll()
          Loads all entries in the loader.
 void start()
           
 void stop()
           
 
Methods inherited from class org.infinispan.loaders.AbstractCacheLoader
containsKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusterCacheLoader

public ClusterCacheLoader()
Method Detail

init

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

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.

load

public InternalCacheEntry load(Object key)
                        throws CacheLoaderException
Description copied from interface: CacheLoader
Loads an entry mapped to by a given key. Should return null if the entry does not exist. Expired entries are not returned.

Parameters:
key - key
Returns:
an entry
Throws:
CacheLoaderException - in the event of problems reading from source

loadAll

public Set<InternalCacheEntry> loadAll()
                                throws CacheLoaderException
Description copied from interface: CacheLoader
Loads all entries in the loader. Expired entries are not returned.

Returns:
a set of entries, or an empty set if the loader is emptied.
Throws:
CacheLoaderException - in the event of problems reading from source

start

public void start()
           throws CacheLoaderException
Throws:
CacheLoaderException

stop

public void stop()
          throws CacheLoaderException
Throws:
CacheLoaderException

getConfigurationClass

public Class<? extends CacheLoaderConfig> getConfigurationClass()
Returns:
the type of the CacheLoaderConfig bean used to configure this implementation of CacheLoader

isCacheReady

protected boolean isCacheReady()
A test to check whether the cache is in its started state. If not, calls should not be made as the channel may not have properly started, blocks due to state transfers may be in progress, etc.

Returns:
true if the cache is in its STARTED state.

Google Analytics

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