org.jboss.cache.loader
Class AsyncExtendedCacheLoader

java.lang.Object
  extended by org.jboss.cache.loader.AsyncCacheLoader
      extended by org.jboss.cache.loader.AsyncExtendedCacheLoader
All Implemented Interfaces:
CacheLoader, ExtendedCacheLoader, org.jboss.system.Service

public class AsyncExtendedCacheLoader
extends AsyncCacheLoader
implements ExtendedCacheLoader

Extends AsyncCacheLoader to supply additional ExtendedCacheLoader methods.

Version:
$Revision$
Author:
Brian Stansberry

Field Summary
 
Fields inherited from class org.jboss.cache.loader.AsyncCacheLoader
DEFAULT_QUEUE_SIZE
 
Constructor Summary
AsyncExtendedCacheLoader(ExtendedCacheLoader cacheLoader)
          Create a new AsyncExtendedCacheLoader.
 
Method Summary
 byte[] loadState(Fqn subtree)
          Fetch a portion of the state for this cache from secondary storage (disk, DB) and return it as a byte buffer.
 void setRegionManager(RegionManager manager)
          Sets the RegionManager this object should use to manage marshalling/unmarshalling of different regions using different classloaders.
 void storeState(byte[] state, Fqn subtree)
          Store the given portion of the cache tree's state in secondary storage.
 
Methods inherited from class org.jboss.cache.loader.AsyncCacheLoader
commit, create, destroy, exists, get, getCacheLoader, getChildrenNames, loadEntireState, prepare, put, put, put, remove, remove, removeData, rollback, setCache, setConfig, start, stop, storeEntireState, 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.loader.CacheLoader
commit, exists, get, getChildrenNames, loadEntireState, prepare, put, put, put, remove, remove, removeData, rollback, setCache, setConfig, storeEntireState
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Constructor Detail

AsyncExtendedCacheLoader

public AsyncExtendedCacheLoader(ExtendedCacheLoader cacheLoader)
Create a new AsyncExtendedCacheLoader.

Parameters:
cacheLoader -
Method Detail

loadState

public byte[] loadState(Fqn subtree)
                 throws java.lang.Exception
Description copied from interface: ExtendedCacheLoader
Fetch a portion of the state for this cache from secondary storage (disk, DB) and return it as a byte buffer. This is for activation of a portion of new cache from a remote cache. The new cache would then call ExtendedCacheLoader.storeState(byte[], Fqn).

Specified by:
loadState in interface ExtendedCacheLoader
Parameters:
subtree - Fqn naming the root (i.e. highest level parent) node of the subtree for which state is requested.
Throws:
java.lang.Exception
See Also:
TreeCache.activateRegion(String)

storeState

public void storeState(byte[] state,
                       Fqn subtree)
                throws java.lang.Exception
Description copied from interface: ExtendedCacheLoader
Store the given portion of the cache tree's state in secondary storage. Overwrite whatever is currently in secondary storage. If the transferred state has Fqns equal to or children of parameter subtree, then no special behavior is required. Otherwise, ensure that the state is integrated under the given subtree. Typically in the latter case subtree would be the Fqn of the buddy backup region for a buddy group; e.g.

If the the transferred state had Fqns starting with "/a" and subtree was "/_BUDDY_BACKUP_/192.168.1.2:5555" then the state should be stored in the local persistent store under "/_BUDDY_BACKUP_/192.168.1.2:5555/a"

Specified by:
storeState in interface ExtendedCacheLoader
Parameters:
state - the state to store
subtree - Fqn naming the root (i.e. highest level parent) node of the subtree included in state. If the Fqns of the data included in state are not already children of subtree, then their Fqns should be altered to make them children of subtree before they are persisted.
Throws:
java.lang.Exception

setRegionManager

public void setRegionManager(RegionManager manager)
Description copied from interface: ExtendedCacheLoader
Sets the RegionManager this object should use to manage marshalling/unmarshalling of different regions using different classloaders.

NOTE: This method is only intended to be used by the TreeCache instance this cache loader is associated with.

Specified by:
setRegionManager in interface ExtendedCacheLoader
Parameters:
manager - the region manager to use, or null.


Copyright 1998-2005 JBoss Inc . All Rights Reserved.