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,/i> this SingletonStore is currently the cordinator. 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.

fromStream

Writes contents of the stream to the store. Implementations should expect that the stream contains data in an
implementation-specific format, typically generated using CacheStore.toStream(java.io.ObjectOutput). While not a
requirement, it is recommended that implementations make use of the Marshaller
when dealing with the stream to make use of efficient marshalling.

It is imperative that implementations do not close the stream after finishing with it.

It is also recommended that implementations use their own start and end markers on the stream since
other processes may write additional data to the stream after the cache store has written to it. As such, either
markers or some other mechanism to prevent the store from reading too much information should be employed when
writing to the stream in CacheStore.fromStream(java.io.ObjectInput) to prevent data corruption.

It can be assumed that the stream passed in already performs buffering such that the cache store implementation
doesn't have to.

activeStatusChanged

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.

Parameters:

newActiveState - true if the cache just became the coordinator, false if the cache stopped being the
coordinator.