org.infinispan.loaders.decorators
Class AsyncStore

java.lang.Object
  extended by org.infinispan.loaders.decorators.AbstractDelegatingStore
      extended by org.infinispan.loaders.decorators.AsyncStore
All Implemented Interfaces:
CacheLoader, CacheStore

public class AsyncStore
extends AbstractDelegatingStore

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.

Since:
4.0
Author:
Manik Surtani, Galder ZamarreƱo

Constructor Summary
AsyncStore(CacheStore delegate, AsyncStoreConfig asyncStoreConfig)
           
 
Method Summary
protected  void applyModificationsSync(ConcurrentMap<Object,Modification> mods)
           
 void clear()
          Clears all entries in the store
protected  Runnable createAsyncProcessor()
           
 void purgeExpired()
          Purges expired entries from the store.
 boolean remove(Object key)
          Removes an entry in the store.
 void start()
           
 void stop()
           
 void store(InternalCacheEntry ed)
          Stores an entry
 
Methods inherited from class org.infinispan.loaders.decorators.AbstractDelegatingStore
commit, containsKey, fromStream, getCacheStoreConfig, getConfigurationClass, getDelegate, init, load, loadAll, prepare, removeAll, rollback, setDelegate, toStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncStore

public AsyncStore(CacheStore delegate,
                  AsyncStoreConfig asyncStoreConfig)
Method Detail

store

public void store(InternalCacheEntry ed)
Description copied from interface: CacheStore
Stores an entry

Specified by:
store in interface CacheStore
Overrides:
store in class AbstractDelegatingStore
Parameters:
ed - entry to store

remove

public boolean remove(Object key)
Description copied from interface: CacheStore
Removes an entry in the store.

Specified by:
remove in interface CacheStore
Overrides:
remove in class AbstractDelegatingStore
Parameters:
key - key to remove
Returns:
true if the entry was removed; false if the entry wasn't found.

clear

public void clear()
Description copied from interface: CacheStore
Clears all entries in the store

Specified by:
clear in interface CacheStore
Overrides:
clear in class AbstractDelegatingStore

purgeExpired

public void purgeExpired()
Description copied from interface: CacheStore
Purges expired entries from the store.

Specified by:
purgeExpired in interface CacheStore
Overrides:
purgeExpired in class AbstractDelegatingStore

start

public void start()
           throws CacheLoaderException
Specified by:
start in interface CacheLoader
Overrides:
start in class AbstractDelegatingStore
Throws:
CacheLoaderException

stop

public void stop()
          throws CacheLoaderException
Specified by:
stop in interface CacheLoader
Overrides:
stop in class AbstractDelegatingStore
Throws:
CacheLoaderException

applyModificationsSync

protected void applyModificationsSync(ConcurrentMap<Object,Modification> mods)
                               throws CacheLoaderException
Throws:
CacheLoaderException

createAsyncProcessor

protected Runnable createAsyncProcessor()

Google Analytics

Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.