|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.cache.loader.AbstractCacheLoader
public abstract class AbstractCacheLoader
A convenience abstract implementation of a CacheLoader
. Specific methods to note are methods like
storeState(org.jboss.cache.Fqn,java.io.ObjectInputStream)
, loadState(org.jboss.cache.Fqn,java.io.ObjectOutputStream)
,
storeEntireState(java.io.ObjectInputStream)
and loadEntireState(java.io.ObjectOutputStream)
which have convenience
implementations here.
put(java.util.List)
, used during the prepare phase of a transaction.
Field Summary | |
---|---|
protected CacheSPI |
cache
|
protected RegionManager |
regionManager
|
Constructor Summary | |
---|---|
AbstractCacheLoader()
|
Method Summary | |
---|---|
protected Marshaller |
getMarshaller()
|
protected void |
getNodeDataList(Fqn fqn,
java.util.List<NodeData> list)
|
void |
loadEntireState(java.io.ObjectOutputStream os)
Fetches the entire state for this cache from secondary storage (disk, database) and writes it to a provided ObjectOutputStream. |
void |
loadState(Fqn subtree,
java.io.ObjectOutputStream os)
Fetches a portion of the state for this cache from secondary storage (disk, database) and writes it to a provided ObjectOutputStream. |
protected void |
loadStateHelper(Fqn fqn,
java.io.ObjectOutputStream out)
Do a preorder traversal: visit the node first, then the node's children |
void |
put(Fqn fqn,
java.util.Map<java.lang.Object,java.lang.Object> attributes,
boolean erase)
|
void |
put(java.util.List<Modification> modifications)
Applies all modifications to the backend store. |
void |
setCache(CacheSPI c)
Sets the CacheSPI that is maintaining this CacheLoader. |
void |
setRegionManager(RegionManager regionManager)
Sets the RegionManager this object should use to manage
marshalling/unmarshalling of different regions using different
classloaders. |
void |
storeEntireState(java.io.ObjectInputStream is)
Stores the entire state for this cache by reading it from a provided ObjectInputStream. |
void |
storeState(Fqn subtree,
java.io.ObjectInputStream in)
Stores the given portion of the cache tree's state in secondary storage. |
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.loader.CacheLoader |
---|
commit, create, destroy, exists, get, getChildrenNames, getConfig, prepare, put, put, remove, remove, removeData, rollback, setConfig, start, stop |
Field Detail |
---|
protected CacheSPI cache
protected RegionManager regionManager
Constructor Detail |
---|
public AbstractCacheLoader()
Method Detail |
---|
public void put(Fqn fqn, java.util.Map<java.lang.Object,java.lang.Object> attributes, boolean erase) throws java.lang.Exception
java.lang.Exception
public void storeEntireState(java.io.ObjectInputStream is) throws java.lang.Exception
CacheLoader
CacheLoader.loadEntireState(ObjectOutputStream)
}
on some other cache instance. State currently in storage gets overwritten.
Implementations of this method should not catch any exception or close the
given ObjectInputStream parameter. In order to ensure cacheloader interoperability
contents of the cache are read from the ObjectInputStream as a sequence of
NodeData objects.
Default implementation is provided by AbstractCacheLoader
and ensures cacheloader
interoperability. Implementors are encouraged to consider extending AbstractCacheLoader
prior to implementing completely custom cacheloader.
storeEntireState
in interface CacheLoader
is
- ObjectInputStream to read state
java.lang.Exception
storeEntireState(ObjectInputStream)
,
NodeData
public void storeState(Fqn subtree, java.io.ObjectInputStream in) throws java.lang.Exception
CacheLoader
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"
Implementations of this method should not catch any exception or close the
given ObjectInputStream parameter. In order to ensure cacheloader interoperability
contents of the cache are read from the ObjectInputStream as a sequence of
NodeData objects.
Default implementation is provided by AbstractCacheLoader
and ensures cacheloader
interoperability. Implementors are encouraged to consider extending AbstractCacheLoader
prior to implementing completely custom cacheloader.
storeState
in interface CacheLoader
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.in
- ObjectInputStream to read state
java.lang.Exception
storeState(Fqn,ObjectInputStream)
,
NodeData
public void loadEntireState(java.io.ObjectOutputStream os) throws java.lang.Exception
CacheLoader
CacheLoader.storeEntireState(ObjectInputStream)
Implementations of this method should not catch any exception or close the
given ObjectOutputStream parameter. In order to ensure cacheloader interoperability
contents of the cache are written to the ObjectOutputStream as a sequence of
NodeData objects.
Default implementation is provided by AbstractCacheLoader
and ensures cacheloader
interoperability. Implementors are encouraged to consider extending AbstractCacheLoader
prior to implementing completely custom cacheloader.
loadEntireState
in interface CacheLoader
os
- ObjectOutputStream to write state
java.lang.Exception
loadEntireState(ObjectOutputStream)
,
NodeData
public void loadState(Fqn subtree, java.io.ObjectOutputStream os) throws java.lang.Exception
CacheLoader
CacheLoader.storeState(Fqn,ObjectInputStream)
.
Implementations of this method should not catch any exception or close the
given ObjectOutputStream parameter. In order to ensure cacheloader interoperability
contents of the cache are written to the ObjectOutputStream as a sequence of
NodeData objects.
Default implementation is provided by AbstractCacheLoader
and ensures cacheloader
interoperability. Implementors are encouraged to consider extending AbstractCacheLoader
prior to implementing completely custom cacheloader.
loadState
in interface CacheLoader
subtree
- Fqn naming the root (i.e. highest level parent) node of
the subtree for which state is requested.os
- ObjectOutputStream to write state
java.lang.Exception
loadState(Fqn,ObjectOutputStream)
,
Region.activate()
,
NodeData
public void setCache(CacheSPI c)
CacheLoader
CacheSPI
that is maintaining this CacheLoader.
This method allows this CacheLoader to set a reference to the CacheSPI
.
This method is called be called after the CacheLoader instance has been constructed.
setCache
in interface CacheLoader
c
- The cache on which this loader workspublic void setRegionManager(RegionManager regionManager)
CacheLoader
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 CacheSPI
instance this cache loader is
associated with.
setRegionManager
in interface CacheLoader
regionManager
- the region manager to use, or null
.protected void loadStateHelper(Fqn fqn, java.io.ObjectOutputStream out) throws java.lang.Exception
fqn
- Start nodeout
-
java.lang.Exception
protected void getNodeDataList(Fqn fqn, java.util.List<NodeData> list) throws java.lang.Exception
java.lang.Exception
public void put(java.util.List<Modification> modifications) throws java.lang.Exception
CacheLoader
put
in interface CacheLoader
modifications
- A Listjava.lang.Exception
protected Marshaller getMarshaller()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |