public abstract class AbstractCacheStore extends AbstractCacheLoader implements CacheStore
CacheStore that holds common implementations for some methods| Modifier and Type | Field and Description |
|---|---|
protected boolean |
multiThreadedPurge |
protected ExecutorService |
purgerService |
cache, marshaller| Constructor and Description |
|---|
AbstractCacheStore() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyModifications(List<? extends Modification> mods) |
void |
commit(GlobalTransaction tx)
Commits a transaction that has been previously prepared.
|
CacheStoreConfig |
getCacheStoreConfig()
Returns the configuration object associated to this cache store config.
|
protected int |
getConcurrencyLevel() |
protected StreamingMarshaller |
getMarshaller() |
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
|
void |
purgeExpired()
Purges expired entries from the store.
|
protected abstract void |
purgeInternal() |
void |
removeAll(Set<Object> keys)
Bulk remove operation
|
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). |
protected static void |
safeClose(InputStream stream) |
protected static void |
safeClose(OutputStream stream) |
void |
start() |
void |
stop() |
protected boolean |
supportsMultiThreadedPurge() |
containsKeyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclear, fromStream, remove, store, toStreamcontainsKey, getConfigurationClass, load, load, loadAll, loadAllKeysprotected ExecutorService purgerService
protected boolean multiThreadedPurge
public void init(CacheLoaderConfig config, Cache<?,?> cache, StreamingMarshaller m) throws CacheLoaderException
CacheLoaderCacheLoaderManager
when setting up cache loaders.init in interface CacheLoaderinit in class AbstractCacheLoaderconfig - 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.CacheLoaderExceptionprotected final int getConcurrencyLevel()
public void start()
throws CacheLoaderException
start in interface CacheLoaderCacheLoaderExceptionprotected boolean supportsMultiThreadedPurge()
public void stop()
throws CacheLoaderException
stop in interface CacheLoaderCacheLoaderExceptionpublic void purgeExpired()
throws CacheLoaderException
CacheStorepurgeExpired in interface CacheStoreCacheLoaderException - in the event of problems writing to the storeprotected abstract void purgeInternal()
throws CacheLoaderException
CacheLoaderExceptionprotected void applyModifications(List<? extends Modification> mods) throws CacheLoaderException
CacheLoaderExceptionpublic void prepare(List<? extends Modification> mods, GlobalTransaction tx, boolean isOnePhase) throws CacheLoaderException
CacheStoreprepare in interface CacheStoremods - modifications to be appliedtx - transaction identifierisOnePhase - if true, there will not be a commit or rollback phase and changes should be flushed
immediatelyCacheLoaderException - 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 accordingly. 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 CacheStoretx - tx to roll backpublic CacheStoreConfig getCacheStoreConfig()
CacheStoregetCacheStoreConfig in interface CacheStorepublic 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 accordingly. 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 CacheStoretx - tx to commitCacheLoaderException - in the event of problems writing to the storepublic void removeAll(Set<Object> keys) throws CacheLoaderException
CacheStoreremoveAll in interface CacheStorekeys - to removeCacheLoaderException - in the event of problems writing to the storeprotected static void safeClose(InputStream stream) throws CacheLoaderException
CacheLoaderExceptionprotected static void safeClose(OutputStream stream) throws CacheLoaderException
CacheLoaderExceptionprotected StreamingMarshaller getMarshaller()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.