|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.infinispan.loaders.decorators.AbstractDelegatingStore
org.infinispan.loaders.decorators.AsyncStore
public class AsyncStore
The AsyncStore is a delegating CacheStore that extends AbstractDelegatingStore, overriding methods to that should not just delegate the operation to the underlying store.
Read operations are done synchronously, while write operations are done asynchronously. There is no provision for exception handling for problems encountered with the underlying store during a write operation, and the exception is just logged. When configuring the loader, use the following element: <async enabled="true" />
to define whether cache loader operations are to be asynchronous. If not specified, a cache loader operation is
assumed synchronous and this decorator is not applied.
Write operations affecting same key are now coalesced so that only the final state is actually stored.
| Field Summary | |
|---|---|
boolean |
lastAsyncProcessorShutsDownExecutor
|
protected ConcurrentMap<Object,Modification> |
state
|
| Constructor Summary | |
|---|---|
AsyncStore(CacheStore delegate,
AsyncStoreConfig asyncStoreConfig)
|
|
| Method Summary | |
|---|---|
protected boolean |
applyClear()
|
protected void |
applyModificationsSync(ConcurrentMap<Object,Modification> mods)
|
void |
clear()
Clears all entries in the store |
void |
commit(GlobalTransaction tx)
Commits a transaction that has been previously prepared. |
protected void |
delegatePurgeExpired()
|
protected void |
enqueueModificationsList(List<? extends Modification> mods)
|
void |
init(CacheLoaderConfig config,
Cache<?,?> cache,
StreamingMarshaller m)
Used to initialize a cache loader. |
void |
prepare(List<? extends Modification> mods,
GlobalTransaction tx,
boolean isOnePhase)
Issues a prepare call with a set of modifications to be applied to the cache store |
boolean |
remove(Object key)
Removes an entry in the store. |
void |
rollback(GlobalTransaction tx)
Rolls back a transaction that has been previously prepared This method may be invoked on a transaction for which there is no prior CacheStore.prepare(java.util.List, org.infinispan.transaction.xa.GlobalTransaction, boolean). |
void |
start()
|
void |
stop()
|
void |
store(InternalCacheEntry ed)
Stores an entry |
| Methods inherited from class org.infinispan.loaders.decorators.AbstractDelegatingStore |
|---|
containsKey, fromStream, getCacheStoreConfig, getConfigurationClass, getDelegate, load, load, loadAll, loadAllKeys, purgeExpired, removeAll, setDelegate, toStream |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ConcurrentMap<Object,Modification> state
public volatile boolean lastAsyncProcessorShutsDownExecutor
| Constructor Detail |
|---|
public AsyncStore(CacheStore delegate,
AsyncStoreConfig asyncStoreConfig)
| Method Detail |
|---|
public void init(CacheLoaderConfig config,
Cache<?,?> cache,
StreamingMarshaller m)
throws CacheLoaderException
CacheLoaderCacheLoaderManager
when setting up cache loaders.
init in interface CacheLoaderinit in class AbstractDelegatingStoreconfig - the cache loader configuration beancache - 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.
CacheLoaderExceptionpublic void store(InternalCacheEntry ed)
CacheStore
store in interface CacheStorestore in class AbstractDelegatingStoreed - entry to storepublic boolean remove(Object key)
CacheStore
remove in interface CacheStoreremove in class AbstractDelegatingStorekey - key to remove
public void clear()
CacheStore
clear in interface CacheStoreclear in class AbstractDelegatingStore
public void prepare(List<? extends Modification> mods,
GlobalTransaction tx,
boolean isOnePhase)
throws CacheLoaderException
CacheStore
prepare in interface CacheStoreprepare in class AbstractDelegatingStoremods - modifications to be appliedtx - transaction identifierisOnePhase - if true, there will not be a commit or rollback phase and changes should be flushed
immediately
CacheLoaderException - in the event of problems writing to the storepublic void rollback(GlobalTransaction tx)
CacheStoreCacheStore.prepare(java.util.List, org.infinispan.transaction.xa.GlobalTransaction, boolean). The implementation would
need to deal with this case acordingly. Typically, this would be a no-op, after ensuring any resources attached
to the transaction are cleared up.
Also note that this method may be invoked on a thread which is different from the CacheStore.prepare(java.util.List, org.infinispan.transaction.xa.GlobalTransaction, boolean) invocation. As such, ThreadLocals should not be relied upon to maintain transaction context.
rollback in interface CacheStorerollback in class AbstractDelegatingStoretx - tx to roll back
public void commit(GlobalTransaction tx)
throws CacheLoaderException
CacheStoreCacheStore.prepare(java.util.List, org.infinispan.transaction.xa.GlobalTransaction, boolean). The implementation would
need to deal with this case acordingly. Typically, this would be a no-op, after ensuring any resources attached
to the transaction are cleared up.
Also note that this method may be invoked on a thread which is different from the CacheStore.prepare(java.util.List, org.infinispan.transaction.xa.GlobalTransaction, boolean) invocation. As such, ThreadLocals should not be relied upon to maintain transaction context.
commit in interface CacheStorecommit in class AbstractDelegatingStoretx - tx to commit
CacheLoaderException - in the event of problems writing to the store
protected void enqueueModificationsList(List<? extends Modification> mods)
throws CacheLoaderException
CacheLoaderException
public void start()
throws CacheLoaderException
start in interface CacheLoaderstart in class AbstractDelegatingStoreCacheLoaderException
public void stop()
throws CacheLoaderException
stop in interface CacheLoaderstop in class AbstractDelegatingStoreCacheLoaderException
protected void applyModificationsSync(ConcurrentMap<Object,Modification> mods)
throws CacheLoaderException
CacheLoaderExceptionprotected boolean applyClear()
protected void delegatePurgeExpired()
|
Google Analytics | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||