Class SingletonCacheWriter
- java.lang.Object
- 
- org.infinispan.persistence.support.DelegatingCacheWriter
- 
- org.infinispan.persistence.support.SingletonCacheWriter
 
 
- 
- All Implemented Interfaces:
- Lifecycle,- CacheWriter
 - Direct Known Subclasses:
- AdvancedSingletonCacheWriter
 
 @Deprecated public class SingletonCacheWriter extends DelegatingCacheWriter Deprecated.this writer will be removed in 10.0. If it is desirable that all nodes don't write to the underlying store then a shared store should be used instead, as this only performs store writes at a key's primary owner.SingletonStore is a delegating cache store used for situations when only one instance should interact with the underlying store. The coordinator of the cluster will be responsible for the underlying CacheStore. SingletonStore is a simply facade to a real CacheStore implementation. It always delegates reads to the real CacheStore. Writes are delegated only if this SingletonStore is currently the coordinator. This avoids having all stores in a cluster writing the same data to the same underlying store. Although not incorrect (e.g. a DB will just discard additional INSERTs for the same key, and throw an exception), this will avoid a lot of redundant work. Whenever the current coordinator dies (or leaves), the second in line will take over. That SingletonStore will then pass writes through to its underlying CacheStore. Optionally, when a new coordinator takes over the Singleton, it can push the in-memory state to the cache cacheStore, within a time constraint.- Since:
- 6.0
- Author:
- Mircea Markus
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classSingletonCacheWriter.PushStateExceptionDeprecated.Exception representing any issues that arise from pushing the in-memory state to the cache loader.classSingletonCacheWriter.SingletonStoreListenerDeprecated.Cache listener that reacts to cluster topology changes to find out whether a new coordinator is elected.
 - 
Field SummaryFields Modifier and Type Field Description protected booleanactiveDeprecated.Whether the the current cache is the coordinator and therefore SingletonStore is active.protected ExecutorServiceexecutorDeprecated.Executor service used to submit tasks to push in-memory state.- 
Fields inherited from class org.infinispan.persistence.support.DelegatingCacheWriteractual, ctx
 
- 
 - 
Constructor SummaryConstructors Constructor Description SingletonCacheWriter(CacheWriter actual, SingletonStoreConfiguration singletonConfiguration)Deprecated.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidactiveStatusChanged(boolean newActiveState)Deprecated.Method called when the cache either becomes the coordinator or stops being the coordinator.protected voidawaitForPushToFinish(Future<?> future, long timeout, TimeUnit unit)Deprecated.Method that waits for the in-memory to cache loader state to finish.protected Callable<?>createPushStateTask()Deprecated.booleandelete(Object key)Deprecated.protected voidpushState(Cache<?,?> cache)Deprecated.Pushes the state of a specific cache by reading the cache's data and putting in the cache store.voidstart()Deprecated.Invoked on component startvoidstop()Deprecated.Invoked on component stopStringtoString()Deprecated.voidwrite(MarshalledEntry entry)Deprecated.Persists the entry to the storage.- 
Methods inherited from class org.infinispan.persistence.support.DelegatingCacheWriterinit, undelegate
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.infinispan.persistence.spi.CacheWriterdeleteBatch, isAvailable, writeBatch
 
- 
 
- 
- 
- 
Field Detail- 
executorprotected final ExecutorService executor Deprecated.Executor service used to submit tasks to push in-memory state.
 - 
activeprotected volatile boolean active Deprecated.Whether the the current cache is the coordinator and therefore SingletonStore is active. Being active means delegating calls to the underlying cache loader.
 
- 
 - 
Constructor Detail- 
SingletonCacheWriterpublic SingletonCacheWriter(CacheWriter actual, SingletonStoreConfiguration singletonConfiguration) Deprecated.
 
- 
 - 
Method Detail- 
startpublic void start() Deprecated.Description copied from interface:LifecycleInvoked on component start- Specified by:
- startin interface- Lifecycle
- Overrides:
- startin class- DelegatingCacheWriter
 
 - 
stoppublic void stop() Deprecated.Description copied from interface:LifecycleInvoked on component stop- Specified by:
- stopin interface- Lifecycle
- Overrides:
- stopin class- DelegatingCacheWriter
 
 - 
writepublic void write(MarshalledEntry entry) Deprecated.Description copied from interface:CacheWriterPersists the entry to the storage.- Specified by:
- writein interface- CacheWriter
- Overrides:
- writein class- DelegatingCacheWriter
- See Also:
- MarshalledEntry
 
 - 
deletepublic boolean delete(Object key) Deprecated.- Specified by:
- deletein interface- CacheWriter
- Overrides:
- deletein class- DelegatingCacheWriter
- Returns:
- true if the entry existed in the persistent store and it was deleted.
 
 - 
createPushStateTaskprotected Callable<?> createPushStateTask() Deprecated.
 - 
pushStateprotected void pushState(Cache<?,?> cache) throws Exception Deprecated.Pushes the state of a specific cache by reading the cache's data and putting in the cache store.- Throws:
- Exception
 
 - 
awaitForPushToFinishprotected void awaitForPushToFinish(Future<?> future, long timeout, TimeUnit unit) Deprecated.Method that waits for the in-memory to cache loader state to finish. This method's called in case a push state is already in progress and we need to wait for it to finish.
 - 
activeStatusChangedprotected void activeStatusChanged(boolean newActiveState) throws SingletonCacheWriter.PushStateExceptionDeprecated.Method called when the cache either becomes the coordinator or stops being the coordinator. If it becomes the coordinator, it can optionally start the in-memory state transfer to the underlying cache store.
 
- 
 
-