public class SingletonStoreCacheLoader extends AbstractDelegatingCacheLoader
| Modifier and Type | Class and Description |
|---|---|
static class |
SingletonStoreCacheLoader.PushStateException
Exception representing any issues that arise from pushing the in-memory state to the cache loader.
|
class |
SingletonStoreCacheLoader.SingletonStoreListener
Cache listener that reacts to cluster topology changes to find out whether a new coordinator is elected.
|
buddyFqnTransformer, cache, regionManager, transactions| Modifier | Constructor and Description |
|---|---|
|
SingletonStoreCacheLoader()
Empty constructor so that it can instantiated using reflection.
|
protected |
SingletonStoreCacheLoader(SingletonStoreDefaultConfig config)
Protected constructor which should only be used from unit tests.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
activeStatusChanged(boolean newActiveState)
Method called when the node either becomes the coordinator or stops being the coordinator.
|
protected void |
awaitForPushToFinish(Future future,
int timeout,
TimeUnit unit)
Method that waits for the in-memory to cache loader state to finish.
|
void |
commit(Object tx)
Calls the underlying cache loader's operation if the current node is the coordinator.
|
void |
create() |
protected Callable<?> |
createPushStateTask()
Factory method for the creation of a Callable task in charge of pushing in-memory state to cache loader.
|
protected Future<?> |
getPushStateFuture()
Returns the Future instance of a running in-memory to cache loader push task.
|
protected SingletonStoreDefaultConfig |
getSingletonStoreDefaultConfig()
Returns SingletonStoreCacheLoader's configuration instance.
|
void |
prepare(Object tx,
List<Modification> modifications,
boolean one_phase)
Calls the underlying cache loader's operation if the current node is the coordinator.
|
protected void |
pushState(NodeSPI node)
Pushes the state of a specific node by reading the node's data from the cache and putting in the cache store
via the cache loader.
|
void |
put(Fqn name,
Map attributes)
Calls the underlying cache loader's operation if the current node is the coordinator.
|
Object |
put(Fqn name,
Object key,
Object value)
Calls the underlying cache loader's operation if the current node is the coordinator.
|
void |
put(List<Modification> modifications)
Calls the underlying cache loader's operation if the current node is the coordinator.
|
void |
remove(Fqn fqn)
Calls the underlying cache loader's operation if the current node is the coordinator.
|
Object |
remove(Fqn fqn,
Object key)
Calls the underlying cache loader's operation if the current node is the coordinator.
|
void |
removeData(Fqn fqn)
Calls the underlying cache loader's operation if the current node is the coordinator.
|
void |
rollback(Object tx)
Calls the underlying cache loader's operation if the current node is the coordinator.
|
void |
setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig config)
Sets the config for SingletonStoreCacheLoader and for the delegating cache loader.
|
void |
storeEntireState(ObjectInputStream is)
Calls the underlying cache loader's operation if the current node is the coordinator.
|
void |
storeState(Fqn subtree,
ObjectInputStream is)
Calls the underlying cache loader's operation if the current node is the coordinator.
|
String |
toString()
Calls the underlying cache loader's operation if the current node is the coordinator.
|
destroy, exists, get, getCacheLoader, getChildrenNames, getConfig, loadEntireState, loadState, setCache, setCacheLoader, setRegionManager, start, stopdoMarshall, doUnmarshall, getMarshaller, getNodeDataList, loadStateHelper, move, put, regionAwareMarshall, regionAwareUnmarshall, storeStateHelperpublic SingletonStoreCacheLoader()
protected SingletonStoreCacheLoader(SingletonStoreDefaultConfig config)
config - configuration instance for SingletonStoreCacheLoaderpublic void setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig config)
setConfig in interface CacheLoadersetConfig in class AbstractDelegatingCacheLoaderconfig - May be an instance of the CacheLoaderConfig.IndividualCacheLoaderConfig base
class, in which case the cache loader should use the
PluggableConfigurationComponent.getProperties()
method to find configuration information. Alternatively,
may be a type-specific subclass of CacheLoaderConfig.IndividualCacheLoaderConfig,
if there is one.public void create()
throws Exception
create in interface Lifecyclecreate in class AbstractDelegatingCacheLoaderExceptionprotected SingletonStoreDefaultConfig getSingletonStoreDefaultConfig()
protected Future<?> getPushStateFuture()
protected void activeStatusChanged(boolean newActiveState)
throws SingletonStoreCacheLoader.PushStateException
newActiveState - true if the node just became the coordinator, false if the nodes stopped being the coordinator.SingletonStoreCacheLoader.PushStateExceptionprotected Callable<?> createPushStateTask()
protected void pushState(NodeSPI node) throws Exception
node - instance of NodeSPI to push to the cache loaderException - if there's any issues reading the data from the cache or pushing the node's data to the cache
loader.protected void awaitForPushToFinish(Future future, int timeout, TimeUnit unit)
future - instance of Future representing the on going push tasktimeout - time to wait for the push task to finishunit - instance of TimeUnit representing the unit of timeoutpublic Object put(Fqn name, Object key, Object value) throws Exception
put in interface CacheLoaderput in class AbstractDelegatingCacheLoaderExceptionpublic void put(Fqn name, Map attributes) throws Exception
put in interface CacheLoaderput in class AbstractDelegatingCacheLoadername - The fully qualified name of the nodeattributes - A Map of attributes. Can be nullExceptionpublic void put(List<Modification> modifications) throws Exception
put in interface CacheLoaderput in class AbstractDelegatingCacheLoadermodifications - A ListExceptionpublic Object remove(Fqn fqn, Object key) throws Exception
remove in interface CacheLoaderremove in class AbstractDelegatingCacheLoaderExceptionpublic void remove(Fqn fqn) throws Exception
remove in interface CacheLoaderremove in class AbstractDelegatingCacheLoaderfqn - the Fqn of the nodeExceptionpublic void removeData(Fqn fqn) throws Exception
removeData in interface CacheLoaderremoveData in class AbstractDelegatingCacheLoaderfqn - the Fqn of the nodeExceptionpublic void prepare(Object tx, List<Modification> modifications, boolean one_phase) throws Exception
prepare in interface CacheLoaderprepare in class AbstractDelegatingCacheLoadertx - The transaction, indended to be used by implementations as an identifier of the transaction (and not necessarily a JTA Transaction object)modifications - A List containing Modifications, for the given transactionone_phase - Persist immediately and (for example) commit the local JDBC transaction as well. When true,
we won't get a CacheLoader.commit(Object) or CacheLoader.rollback(Object) method call laterExceptionpublic void commit(Object tx) throws Exception
commit in interface CacheLoadercommit in class AbstractDelegatingCacheLoadertx - transaction to commitExceptionpublic void rollback(Object tx)
rollback in interface CacheLoaderrollback in class AbstractDelegatingCacheLoadertx - transaction to roll backpublic void storeEntireState(ObjectInputStream is) throws Exception
storeEntireState in interface CacheLoaderstoreEntireState in class AbstractDelegatingCacheLoaderis - ObjectInputStream to read stateExceptionAbstractCacheLoader.storeEntireState(ObjectInputStream),
NodeDatapublic void storeState(Fqn subtree, ObjectInputStream is) throws Exception
storeState in interface CacheLoaderstoreState in class AbstractDelegatingCacheLoadersubtree - 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.is - ObjectInputStream to read stateExceptionAbstractCacheLoader.storeState(Fqn,ObjectInputStream),
NodeDataCopyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.