public class AsyncCacheLoader extends AbstractDelegatingCacheLoader
<attribute name="CacheLoaderAsynchronous">true</attribute>
to define whether cache loader operations are to be asynchronous. If not
specified, a cache loader operation is assumed synchronous.
The following additional parameters are available:
true, this loader returns the old values from put(org.jboss.cache.Fqn, java.lang.Object, java.lang.Object) and remove(org.jboss.cache.Fqn, java.lang.Object) methods. Otherwise, these methods always return
null. Default is true. false improves the performance of these
operations.put(org.jboss.cache.Fqn, java.lang.Object, java.lang.Object) operations will be processed
synchronously, and then only the remove(org.jboss.cache.Fqn, java.lang.Object) operations will be
processed asynchronously. This mode may be useful for processing
expiration of messages within a separate thread and keeping other
operations synchronous for reliability.
cache.async.batchSize and
cache.async.pollWait. For larger sized records, use a smaller
value for cache.async.queueSize.buddyFqnTransformer, cache, regionManager, transactions| Constructor and Description |
|---|
AsyncCacheLoader() |
AsyncCacheLoader(CacheLoader cacheLoader) |
| Modifier and Type | Method and Description |
|---|---|
void |
commit(Object tx)
TODO this is the same as the AbstractCacheLoader.
|
Map |
get(Fqn name)
Returns all keys and values from the persistent store, given a
Fqn |
void |
prepare(Object tx,
List<Modification> modifications,
boolean one_phase)
TODO this is the same as the AbstractCacheLoader.
|
void |
put(Fqn name,
Map attributes)
Puts all entries of the map into the existing map of the given node,
overwriting existing keys, but not clearing the existing map before
insertion.
|
Object |
put(Fqn name,
Object key,
Object value)
Puts a key and value into the attribute map of a given node.
|
void |
put(List<Modification> modifications)
Applies all modifications to the backend store.
|
void |
remove(Fqn name)
Removes the given node and all its subnodes, does nothing if the node does not exist.
|
Object |
remove(Fqn name,
Object key)
Removes the given key and value from the attributes of the given node.
|
void |
removeData(Fqn name)
Removes all attributes from a given node, but doesn't delete the node
itself or any subnodes.
|
void |
rollback(Object tx)
TODO this is the same as the AbstractCacheLoader.
|
void |
setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig base)
Sets the configuration.
|
void |
start() |
void |
stop() |
String |
toString() |
create, destroy, exists, getCacheLoader, getChildrenNames, getConfig, loadEntireState, loadState, setCache, setCacheLoader, setRegionManager, storeEntireState, storeStatedoMarshall, doUnmarshall, getMarshaller, getNodeDataList, loadStateHelper, move, put, regionAwareMarshall, regionAwareUnmarshall, storeStateHelperpublic AsyncCacheLoader()
public AsyncCacheLoader(CacheLoader cacheLoader)
public void setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig base)
CacheLoaderLifecycle.create() and Lifecycle.start().setConfig in interface CacheLoadersetConfig in class AbstractDelegatingCacheLoaderbase - 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 Map get(Fqn name) throws Exception
CacheLoaderFqnget in interface CacheLoaderget in class AbstractDelegatingCacheLoadername - the Fqn to search for.Exceptionpublic 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 Object put(Fqn name, Object key, Object value) throws Exception
CacheLoaderput in interface CacheLoaderput in class AbstractDelegatingCacheLoaderExceptionpublic void put(Fqn name, Map attributes) throws Exception
CacheLoaderMap.putAll(java.util.Map<? extends K, ? extends V>).
If the node does not exist, all parent nodes from the root down are created automatically
Note since 3.0, as an optimization, this method will require a definitive attribute map and
not just a subset. This will allow cache loader implementations to overwrite rather than merge, if that is
deemed more efficient. This will not break backward compatibility since performing a merge will not cause
any loss of data even though it is an unnecessary step.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
CacheLoaderput in interface CacheLoaderput in class AbstractDelegatingCacheLoadermodifications - A ListExceptionpublic Object remove(Fqn name, Object key) throws Exception
CacheLoaderremove in interface CacheLoaderremove in class AbstractDelegatingCacheLoaderExceptionpublic void remove(Fqn name) throws Exception
CacheLoaderremove in interface CacheLoaderremove in class AbstractDelegatingCacheLoadername - the Fqn of the nodeExceptionpublic void removeData(Fqn name) throws Exception
CacheLoaderremoveData in interface CacheLoaderremoveData in class AbstractDelegatingCacheLoadername - the Fqn of the nodeExceptionpublic void start()
throws Exception
start in interface Lifecyclestart in class AbstractDelegatingCacheLoaderExceptionpublic void stop()
stop in interface Lifecyclestop in class AbstractDelegatingCacheLoaderCopyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.