#include <coherence/net/cache/ContinuousQueryCache.hpp>
Inherits AbstractMap, and NamedCache.
Public Types | |||||||||||||
typedef spec::Handle | Handle | ||||||||||||
ContinuousQueryCache Handle definition. | |||||||||||||
typedef spec::View | View | ||||||||||||
ContinuousQueryCache View definition. | |||||||||||||
typedef spec::Holder | Holder | ||||||||||||
ContinuousQueryCache Holder definition. | |||||||||||||
Public Member Functions | |||||||||||||
virtual NamedCache::View | getCache () const | ||||||||||||
Obtain the NamedCache that this ContinuousQueryCache is based on. | |||||||||||||
virtual NamedCache::Handle | getCache () | ||||||||||||
Obtain the NamedCache that this ContinuousQueryCache is based on. | |||||||||||||
virtual Filter::View | getFilter () const | ||||||||||||
Obtain the Filter that this ContinuousQueryCache is using to query the underlying NamedCache. | |||||||||||||
virtual ValueExtractor::View | getTransformer () const | ||||||||||||
Obtain the transformer that this ContinuousQueryCache is using to transform the results from the underlying cache. | |||||||||||||
virtual MapListener::View | getMapListener () const | ||||||||||||
Obtain the MapListener provided at construction time for this ContinuousQueryCache. | |||||||||||||
virtual bool | isCacheValues () const | ||||||||||||
Determine if this ContinuousQueryCache caches values locally. | |||||||||||||
virtual void | setCacheValues (bool fCacheValues) | ||||||||||||
Modify the local-caching option for the ContinuousQueryCache. | |||||||||||||
virtual bool | isReadOnly () const | ||||||||||||
Determine if this ContinuousQueryCache disallows data modification operations. | |||||||||||||
virtual void | setReadOnly (bool fReadOnly) | ||||||||||||
Modify the read-only option for the ContinuousQueryCache. | |||||||||||||
virtual int32_t | getState () const | ||||||||||||
Obtain the state of the ContinuousQueryCache. | |||||||||||||
virtual int64_t | getReconnectInterval () const | ||||||||||||
Return the reconnection interval (in milliseconds). | |||||||||||||
virtual void | setReconnectInterval (int64_t cReconnectMillis) | ||||||||||||
Specify the reconnection interval (in milliseconds). | |||||||||||||
virtual Supplier::View | getCacheNameSupplier () const | ||||||||||||
Return the Supplier used to provide the name of this ContinuousQueryCache. | |||||||||||||
virtual void | setCacheNameSupplier (Supplier::View vCacheNameSupplier) | ||||||||||||
Provide the Supplier used to provide the name of this ContinuousQueryCache. | |||||||||||||
virtual Object::Holder | get (Object::View vKey) const | ||||||||||||
Return the value to which this map maps the specified key.
Return
| |||||||||||||
virtual Object::Holder | put (Object::View vKey, Object::Holder ohValue) | ||||||||||||
Associate the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced by the specified value.
| |||||||||||||
virtual Object::Holder | remove (Object::View vKey) | ||||||||||||
Remove the mapping for this key from this map if it is present.
Return the value to which the map previously associated the key, or
| |||||||||||||
virtual void | putAll (Map::View vMap) | ||||||||||||
virtual void | clear () | ||||||||||||
Remove all mappings from this map.
| |||||||||||||
virtual bool | containsKey (Object::View vKey) const | ||||||||||||
Return true if this map contains a mapping for the specified key.
| |||||||||||||
virtual Set::View | keySet () const | ||||||||||||
Return a set of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set. If the map is modified while an iteration over the set is in progress, the results of the iteration are undefined.
| |||||||||||||
virtual Set::Handle | keySet () | ||||||||||||
Return a set of the keys contained in this map. The set is backed by the map, so changes to one are reflected in the other. If the map is modified while an iteration over the set is in progress, the results of the iteration are undefined.
| |||||||||||||
virtual Set::View | entrySet () const | ||||||||||||
Return a set of the mappings contained in this map. Each element in the returned set is a Map::Entry::View. The set is backed by the map, so changes to the map are reflected in the set. If the map is modified while an iteration over the set is in progress, the results of the iteration are undefined.
| |||||||||||||
virtual Set::Handle | entrySet () | ||||||||||||
Return a set of the mappings contained in this map. Each element in the returned set is a Map::Entry::Handle. The set is backed by the map, so changes to one are reflected in the other. If the map is modified while an iteration over the set is in progress, the results of the iteration are undefined.
| |||||||||||||
virtual size32_t | size () const | ||||||||||||
Return the number of key-value mappings in this map.
| |||||||||||||
virtual Map::View | getAll (Collection::View vKeys) const | ||||||||||||
Get all the specified keys, if they are in the cache. For each key that is in the cache, that key and its corresponding value will be placed in the map that is returned by this method. The absence of a key in the returned map indicates that it was not in the cache, which may imply (for caches that can load behind the scenes) that the requested data could not be loaded. The result of this method is defined to be semantically the same as the following implementation, without regards to threading issues: // could be a HashMap (but does not have to) Map::Handle hMap = SomeMap::create(); for (Iterator::Handle iter = colKeys->iterator(); iter->hasNext();) { Object::View hKey = iter->next(); Object::View hVal = get(hKey); if (hVal || containsKey(hKey)) { hMap->put(hKey, hVal); } } return hMap;
| |||||||||||||
virtual Object::Holder | put (Object::View vKey, Object::Holder ohValue, int64_t cMillis) | ||||||||||||
Associates the specified value with the specified key in this cache. If the cache previously contained a mapping for this key, the old value is replaced. This variation of the put(Object::View, Object::View) method allows the caller to specify an expiry (or "time to live") for the cache entry.
| |||||||||||||
virtual void | addKeyListener (MapListener::Handle hListener, Object::View vKey, bool fLite) | ||||||||||||
virtual void | removeKeyListener (MapListener::Handle hListener, Object::View vKey) | ||||||||||||
virtual void | addMapListener (MapListener::Handle hListener) | ||||||||||||
virtual void | removeMapListener (MapListener::Handle hListener) | ||||||||||||
virtual void | addFilterListener (MapListener::Handle hListener, Filter::View vFilter=NULL, bool fLite=false) | ||||||||||||
virtual void | removeFilterListener (MapListener::Handle hListener, Filter::View vFilter=NULL) | ||||||||||||
virtual Set::View | keySet (Filter::View vFilter) const | ||||||||||||
virtual Set::View | entrySet (Filter::View vFilter) const | ||||||||||||
virtual Set::View | entrySet (Filter::View vFilter, Comparator::View vComparator) const | ||||||||||||
virtual void | addIndex (ValueExtractor::View vExtractor, bool fOrdered, Comparator::View vComparator) | ||||||||||||
If isCacheValues is true, the index will be created locally as well as on the NamedCache this ContinuousQueryCache wraps, otherwise, the index will be created on the wrapped NamedCache only. | |||||||||||||
virtual void | removeIndex (ValueExtractor::View vExtractor) | ||||||||||||
If isCacheValues() is true, the index will be removed locally, however, this call will not cause the index on the NamedCache this ContinuousQueryCache wraps. | |||||||||||||
virtual Object::Holder | invoke (Object::View vKey, InvocableMap::EntryProcessor::Handle hAgent) | ||||||||||||
virtual Map::View | invokeAll (Collection::View vCollKeys, InvocableMap::EntryProcessor::Handle hAgent) | ||||||||||||
virtual Map::View | invokeAll (Filter::View vFilter, InvocableMap::EntryProcessor::Handle hAgent) | ||||||||||||
virtual Object::Holder | aggregate (Collection::View vCollKeys, InvocableMap::EntryAggregator::Handle hAgent) const | ||||||||||||
virtual Object::Holder | aggregate (Filter::View vFilter, InvocableMap::EntryAggregator::Handle hAgent) const | ||||||||||||
virtual bool | lock (Object::View vKey, int64_t cWait) const | ||||||||||||
Attempt to lock the specified item within the specified period of time. The item doesn't have to exist to be locked. While the item is locked there is known to be a lock holder which has an exclusive right to modify (calling put and remove methods) that item. Lock holder is an abstract concept that depends on the ConcurrentMap implementation. For example, holder could be a process or a thread (or both). Locking strategy may vary for concrete implementations as well. Lock could have an expiration time (this lock is sometimes called a "lease") or be held indefinitely (until the lock holder terminates). Some implementations may allow the entire map to be locked. If the map is locked in such a way, then only a lock holder is allowed to perform any of the "put" or "remove" operations. Pass the special constant getLockAll() as the vKey parameter to indicate the map lock.
| |||||||||||||
virtual bool | lock (Object::View vKey) const | ||||||||||||
Attempt to lock the specified item and return immediately.
This method behaves exactly as if it simply performs the call
| |||||||||||||
virtual bool | unlock (Object::View vKey) const | ||||||||||||
Unlock the specified item. The item doesn't have to exist to be unlocked. If the item is currently locked, only the holder of the lock could successfully unlock it.
| |||||||||||||
virtual String::View | getCacheName () const | ||||||||||||
Return the cache name.
| |||||||||||||
virtual CacheService::Handle | getCacheService () | ||||||||||||
Return the CacheService that this NamedCache is a part of.
| |||||||||||||
virtual CacheService::View | getCacheService () const | ||||||||||||
Return the CacheService that this NamedCache is a part of.
| |||||||||||||
virtual bool | isActive () const | ||||||||||||
Specifies whether or not the NamedCache is active.
| |||||||||||||
virtual void | release () | ||||||||||||
Release local resources associated with this instance of NamedCache. Releasing a cache makes it no longer usable, but does not affect the cache itself. In other words, all other references to the cache will still be valid, and the cache data is not affected by releasing the reference. Any attempt to use this reference afterward will result in an exception. Caches should be released by the same mechanism in which they were obtained. For example:
| |||||||||||||
virtual void | destroy () | ||||||||||||
Release and destroy this instance of NamedCache. Warning: This method is used to completely destroy the specified cache across the cluster. All references in the entire cluster to this cache will be invalidated, the cached data will be cleared, and all resources will be released. Caches should be destroyed by the same mechanism in which they were obtained. For example:
| |||||||||||||
virtual void | truncate () | ||||||||||||
Removes all mappings from this map. Note: the removal of entries caused by this truncate operation will not be observable. This includes any registered listeners, triggers, or interceptors. However, a CacheLifecycleEvent is raised to notify subscribers of the execution of this operation.
| |||||||||||||
Static Public Attributes | |||||||||||||
static const int32_t | state_disconnected | ||||||||||||
State: Disconnected state. | |||||||||||||
static const int32_t | state_configuring | ||||||||||||
State: The ContinuousQueryCache is configuring or re-configuring its listeners and content. | |||||||||||||
static const int32_t | state_configured | ||||||||||||
State: The ContinousQueryCache has been configured. | |||||||||||||
static const int32_t | state_synchronized | ||||||||||||
State: The ContinousQueryCache has been configured and fully synchronized. | |||||||||||||
Protected Member Functions | |||||||||||||
ContinuousQueryCache (NamedCache::Handle hCache, Filter::View vFilter, bool fCacheValues=false, MapListener::Handle hListener=NULL, ValueExtractor::View vTransformer=NULL) | |||||||||||||
Create a materialized view of a NamedCache using a Filter. | |||||||||||||
ContinuousQueryCache (Supplier::View vCacheSupplier, Filter::View vFilter, bool fCacheValues, MapListener::Handle hListener, ValueExtractor::View vTransformer) | |||||||||||||
Create a materialized view of a NamedCache using a Filter. | |||||||||||||
virtual ObservableMap::Handle | instantiateInternalCache () const | ||||||||||||
Create the internal cache used by the ContinuousQueryCache. | |||||||||||||
virtual ObservableMap::View | getInternalCache () const | ||||||||||||
Obtain a reference to the internal cache. | |||||||||||||
virtual ObservableMap::Handle | getInternalCache () | ||||||||||||
Obtain a reference to the internal cache. | |||||||||||||
virtual bool | isObserved () const | ||||||||||||
Determine if the ContinuousQueryCache has any listeners that cannot be served by this Map listening to lite events. | |||||||||||||
virtual void | setObserved (bool fObserved) | ||||||||||||
Specify whether the ContinuousQueryCache has any listeners that cannot be served by this Map listening to lite events. | |||||||||||||
virtual void | changeState (int32_t nState) const | ||||||||||||
Change the state of the ContinuousQueryCache. | |||||||||||||
virtual Filter::View | mergeFilter (Filter::View vFilter) const | ||||||||||||
Return a filter which merges the ContinousQueueCache's filter with the supplied filter. | |||||||||||||
virtual void | checkReadOnly () const | ||||||||||||
Check the read-only setting to verify that the cache is NOT read-only. | |||||||||||||
virtual void | checkEntry (Map::Entry::View vEntry) | ||||||||||||
Check the passed value to verify that it does belong in this ContinuousQueryCache. | |||||||||||||
virtual void | checkEntry (Object::View vKey, Object::Holder ohValue) | ||||||||||||
Check the passed value to verify that it does belong in this ContinuousQueryCache. | |||||||||||||
virtual String::View | getStateString (int32_t nState) const | ||||||||||||
Return a String description of the provided STATE_* variables. | |||||||||||||
virtual void | configureSynchronization (bool fReload) const | ||||||||||||
Set up the listeners that keep the ContinuousQueryCache up-to-date. | |||||||||||||
virtual RuntimeException::View | createUnexpectedStateException (int32_t nExpectedState, int32_t nActualState) const | ||||||||||||
Simple helper to create an exception for communicating invalid state transitions. | |||||||||||||
virtual Filter::View | createTransformerFilter (MapEventFilter::View vFilterAdd) const | ||||||||||||
Wrap specified MapEventFilter with a MapEventTransformerFilter that will either transform cache value using transformer defined for this ContinuousQueryCache, or remove the old value from the event using SemiLiteEventTransformer, if no transformer is defined for this CQC. | |||||||||||||
virtual void | ensureSynchronized (bool fReload) const | ||||||||||||
Ensure that the ContinousQueryCache listeners have been registered and its content synchronized with the underlying NamedCache. | |||||||||||||
virtual bool | isEventDeferred (Object::View vKey) const | ||||||||||||
Called when an event has occurred. | |||||||||||||
virtual bool | removeBlind (Object::View vKey) | ||||||||||||
Removes the mapping for this key from this map if present. | |||||||||||||
virtual Set::View | getInternalKeySet () const | ||||||||||||
Obtain a set of keys that are represented by this Map. | |||||||||||||
virtual NamedCache::Handle | getCacheInternal () const | ||||||||||||
Return the underlying cache. | |||||||||||||
virtual MapListener::Handle | instantiateAddListener () const | ||||||||||||
Factory Method: Instantiate a MapListener for adding items to the query, and (if there are listeners on the ContinuousQueryCache) for dispatching inserts and updates. | |||||||||||||
virtual MapListener::Handle | instantiateRemoveListener () const | ||||||||||||
Factory Method: Instantiate a MapListener for evicting items from the query. | |||||||||||||
virtual void | registerServiceListener () const | ||||||||||||
Instantiate and register a MemberListener with the underlying caches's service. | |||||||||||||
virtual void | unregisterServiceListener () const | ||||||||||||
Unregister underlying caches's service member listener. | |||||||||||||
virtual ObservableMap::Handle | ensureInternalCache () const | ||||||||||||
Create and initialize this ContinuousQueryCache's (if not already present) internal cache. | |||||||||||||
virtual void | ensureSaneCache (Collection::View vCollKeys) const | ||||||||||||
Verify that the non-existent keys are NOT present in the underlying cache (assumption is most keys in the collection are already in the ContinuousQueryCache). | |||||||||||||
virtual void | registerDeactivationListener () const | ||||||||||||
Instantiate and register a NamedCacheDeactivationListener with the underlying cache service. | |||||||||||||
virtual void | unregisterDeactivationListener () const | ||||||||||||
Unregister underlying cache service member listener. | |||||||||||||
virtual void | releaseListeners () const | ||||||||||||
Release the listeners. | |||||||||||||
virtual MultiplexingMapListener::Handle | instantiateEventRouter (MapListener::Handle hListener, bool fLite) const | ||||||||||||
Factory Method: Instantiate a listener on the internal map that will direct events to the passed listener, either synchronously or asynchronously as appropriate. | |||||||||||||
virtual TaskDaemon::Handle | instantiateEventQueue () const | ||||||||||||
Create a self-processing event queue. | |||||||||||||
virtual TaskDaemon::Handle | getEventQueue () const | ||||||||||||
Obtain this ContinuousQueryCache's event queue. | |||||||||||||
virtual TaskDaemon::Handle | ensureEventQueue () const | ||||||||||||
Obtain the existing event queue or create one if none exists. | |||||||||||||
virtual void | shutdownEventQueue () | ||||||||||||
Shut down running event queue. | |||||||||||||
virtual Set::Handle | instantiateKeySet () | ||||||||||||
Create a new key set. | |||||||||||||
virtual Set::Handle | instantiateEntrySet () | ||||||||||||
Create a new EntrySet. | |||||||||||||
virtual Map::Handle | ensureIndexMap () | ||||||||||||
Ensure that the map of indexes maintained by this cache exists. | |||||||||||||
virtual Map::View | getIndexMap () const | ||||||||||||
Get the map of indexes maintained by this cache. | |||||||||||||
virtual Map::Handle | getIndexMap () | ||||||||||||
Get the map of indexes maintained by this cache. | |||||||||||||
virtual void | releaseIndexMap () | ||||||||||||
Release the the entire index map. | |||||||||||||
virtual void | onInit () | ||||||||||||
Event called once the Object has finished being constructed. Specifically when the first attachment is made. This provides a safe point at which Handles/Views to "this" can be created. It is not safe to create Handles/Views to an Object from within its constructor, thus any operations which rely upon this should be deferred until the onInit event is triggered. As with all event methods any derived implementation should include a call to the super class's implementation. Specifically delegation to Object::onInit() must eventually occur or an IllegalStateException will result.
The default implementation calls the onInit() method of each of the Object's SmartMembers. | |||||||||||||
Protected Attributes | |||||||||||||
MemberHandle < NamedCache > | m_hCache | ||||||||||||
The underlying NamedCache object. | |||||||||||||
FinalView< String > | f_vsName | ||||||||||||
The name of the underlying NamedCache. | |||||||||||||
FinalView< Filter > | f_vFilter | ||||||||||||
The filter that represents the subset of information from the underlying NamedCache that this ContinuousQueryCache represents. | |||||||||||||
bool | m_fCacheValues | ||||||||||||
The option of whether or not to locally cache values. | |||||||||||||
bool | m_fReadOnly | ||||||||||||
The option to disallow modifications through this ContinuousQueryCache interface. | |||||||||||||
int64_t | m_cReconnectMillis | ||||||||||||
The interval (in milliseconds) that indicates how often the ContinuousQueryCache should attempt to synchronize its content with the underlying cache in case the connection is severed. | |||||||||||||
Volatile< int64_t > | m_ldtConnectionTimestamp | ||||||||||||
The timestamp when the synchronization was last attempted. | |||||||||||||
MemberHandle < ObservableMap > | m_hMapLocal | ||||||||||||
The keys that are in this ContinuousQueryCache, and (if m_fCacheValues is true) the corresponding values as well. | |||||||||||||
Volatile< int32_t > | m_nState | ||||||||||||
State of the ContinousQueryCache. | |||||||||||||
MemberHandle< Map > | m_hMapSyncReq | ||||||||||||
While the ContinuousQueryCache is configuring or re-configuring its listeners and content, any events that are received must be logged to ensure that the corresponding content is in sync. | |||||||||||||
MemberHandle < TaskDaemon > | m_hTaskQueue | ||||||||||||
The event queue for this ContinuousQueryCache. | |||||||||||||
bool | m_fListeners | ||||||||||||
Keeps track of whether the ContinuousQueryCache has listeners that require this cache to cache values. | |||||||||||||
MemberView < MapEventFilter > | m_vFilterAdd | ||||||||||||
The MapEventFilter that uses the ContinuousQueryCache's filter to select events that would add elements to this cache's contents. | |||||||||||||
MemberView < MapEventFilter > | m_vFilterRemove | ||||||||||||
The MapEventFilter that uses the ContinuousQueryCache's filter to select events that would remove elements from this cache's contents. | |||||||||||||
WeakHandle< MapListener > | m_whListenerAdd | ||||||||||||
The listener that gets information about what should be in this cache. | |||||||||||||
WeakHandle< MapListener > | m_whListenerRemove | ||||||||||||
The listener that gets information about what should be thrown out of this cache. | |||||||||||||
WeakHandle < MemberListener > | m_whListenerService | ||||||||||||
The cache service MemberListener for the underlying NamedCache. | |||||||||||||
FinalView < ValueExtractor > | f_vTransformer | ||||||||||||
The transformer that should be used to convert values from the underlying cache. | |||||||||||||
FinalHandle< Map > | f_hMapIndex | ||||||||||||
The map of indexes maintained by this cache. | |||||||||||||
FinalHandle< Set > | f_hSetKeys | ||||||||||||
KeySet backed by this cache. | |||||||||||||
FinalHandle< Set > | f_hSetEntries | ||||||||||||
EntrySet backed by this cache. | |||||||||||||
FinalView< Supplier > | f_vCacheSupplier | ||||||||||||
The Supplier of the NamedCache to create a view of. | |||||||||||||
MemberView< Supplier > | m_vCacheNameSupplier | ||||||||||||
The optional supplier to obtain this cache's name. | |||||||||||||
MemberHandle < MapListener > | m_hListenerDeactivation | ||||||||||||
The NamedCache deactivation listener. | |||||||||||||
Classes | |||||||||||||
class | AsynchronousEvent | ||||||||||||
Encapsulates an event and a listener that are to be dispatched asynchronously. More... | |||||||||||||
class | TaskDaemon | ||||||||||||
Daemon thread used to dispatch messages asynchronously. More... |
ContinuousQueryCache | ( | NamedCache::Handle | hCache, | |
Filter::View | vFilter, | |||
bool | fCacheValues = false , |
|||
MapListener::Handle | hListener = NULL , |
|||
ValueExtractor::View | vTransformer = NULL | |||
) | [protected] |
Create a materialized view of a NamedCache using a Filter.
A materialized view is an implementation of Continuous Query exposed through the standard NamedCache API. This constructor allows a client to receive all events, including those that result from the initial population of the ContinuousQueryCache. In other words, all contents of the ContinuousQueryCache will be delivered to the listener as a sequence of events, including those items that already exist in the underlying (unfiltered) cache.
hCache | the NamedCache to create a view of | |
vFilter | the Filter that defines the view | |
fCacheValues | pass true to cache both the keys and values of the materialized view locally, or false to only cache the keys | |
hListener | an initial MapListener that will receive all the events from the ContinuousQueryCache, including those corresponding to its initial population | |
vTransformer | the transformer that should be used to convert values from the underlying cache before storing them locally |
ContinuousQueryCache | ( | Supplier::View | vCacheSupplier, | |
Filter::View | vFilter, | |||
bool | fCacheValues, | |||
MapListener::Handle | hListener, | |||
ValueExtractor::View | vTransformer | |||
) | [protected] |
Create a materialized view of a NamedCache using a Filter.
A materialized view is an implementation of Continuous Query exposed through the standard NamedCache API. This constructor allows a client to receive all events, including those that result from the initial population of the ContinuousQueryCache. In other words, all contents of the ContinuousQueryCache will be delivered to the listener as a sequence of events, including those items that already exist in the underlying (unfiltered) cache.
vCacheSupplier | the Supplier returning the NamedCache to create a view of | |
vFilter | the Filter that defines the view | |
fCacheValues | pass true to cache both the keys and values of the materialized view locally, or false to only cache the keys | |
hListener | an initial MapListener that will receive all the events from the ContinuousQueryCache, including those corresponding to its initial population | |
vTransformer | the transformer that should be used to convert values from the underlying cache before storing them locally |
virtual NamedCache::View getCache | ( | ) | const [virtual] |
virtual NamedCache::Handle getCache | ( | ) | [virtual] |
virtual Filter::View getFilter | ( | ) | const [virtual] |
Obtain the Filter that this ContinuousQueryCache is using to query the underlying NamedCache.
virtual ValueExtractor::View getTransformer | ( | ) | const [virtual] |
Obtain the transformer that this ContinuousQueryCache is using to transform the results from the underlying cache.
virtual MapListener::View getMapListener | ( | ) | const [virtual] |
Obtain the MapListener provided at construction time for this ContinuousQueryCache.
virtual bool isCacheValues | ( | ) | const [virtual] |
Determine if this ContinuousQueryCache caches values locally.
virtual void setCacheValues | ( | bool | fCacheValues | ) | [virtual] |
Modify the local-caching option for the ContinuousQueryCache.
By changing this value from false
to true
, the ContinuousQueryCache will fully realize its contents locally and maintain them coherently in a manner analogous to the Coherence NearCache. By changing this value from true
to false
, the ContinuousQueryCache will discard its locally cached data and rely on the underlying NamedCache.
fCacheValues | pass true to enable local caching, or false to disable it |
virtual bool isReadOnly | ( | ) | const [virtual] |
Determine if this ContinuousQueryCache disallows data modification operations.
virtual void setReadOnly | ( | bool | fReadOnly | ) | [virtual] |
Modify the read-only option for the ContinuousQueryCache.
Note that the cache can be made read-only, but the opposite (making it mutable) is explicitly disallowed.
fReadOnly | pass true to prohibit clients from making modifications to this cache |
virtual int32_t getState | ( | ) | const [virtual] |
virtual int64_t getReconnectInterval | ( | ) | const [virtual] |
Return the reconnection interval (in milliseconds).
This value indicates the period in which re-synchronization with the underlying cache will be delayed in the case the connection is severed. During this time period, local content can be accessed without triggering re-synchronization of the local content.
virtual void setReconnectInterval | ( | int64_t | cReconnectMillis | ) | [virtual] |
Specify the reconnection interval (in milliseconds).
This value indicates the period in which re-synchronization with the underlying cache will be delayed in the case the connection is severed. During this time period, local content can be accessed without triggering re-synchronization of the local content.
cReconnectMillis | reconnection interval (in milliseconds). A value of zero or less means that the ContinuousQueryCache cannot be used when not connected. |
virtual Supplier::View getCacheNameSupplier | ( | ) | const [virtual] |
Return the Supplier used to provide the name of this ContinuousQueryCache.
virtual void setCacheNameSupplier | ( | Supplier::View | vCacheNameSupplier | ) | [virtual] |
Provide the Supplier used to provide the name of this ContinuousQueryCache.
vCacheNameSupplier | the Supplier used to provide the name of this ContinuousQueryCache |
virtual ObservableMap::Handle instantiateInternalCache | ( | ) | const [protected, virtual] |
Create the internal cache used by the ContinuousQueryCache.
virtual ObservableMap::View getInternalCache | ( | ) | const [protected, virtual] |
Obtain a reference to the internal cache.
The internal cache maintains all of the keys in the ContinuousQueryCache, and if isCacheValues()is true, it also maintains the up-to-date values corresponding to those keys.
virtual ObservableMap::Handle getInternalCache | ( | ) | [protected, virtual] |
Obtain a reference to the internal cache.
The internal cache maintains all of the keys in the ContinuousQueryCache, and if isCacheValues()is true, it also maintains the up-to-date values corresponding to those keys.
virtual bool isObserved | ( | ) | const [protected, virtual] |
Determine if the ContinuousQueryCache has any listeners that cannot be served by this Map listening to lite events.
virtual void setObserved | ( | bool | fObserved | ) | [protected, virtual] |
Specify whether the ContinuousQueryCache has any listeners that cannot be served by this Map listening to lite events.
fObserved | true iff there is at least one listener |
virtual void changeState | ( | int32_t | nState | ) | const [protected, virtual] |
virtual void addIndex | ( | ValueExtractor::View | vExtractor, | |
bool | fOrdered, | |||
Comparator::View | vComparator | |||
) | [virtual] |
If isCacheValues is true, the index will be created locally as well as on the NamedCache this ContinuousQueryCache wraps, otherwise, the index will be created on the wrapped NamedCache only.
See QueryMap::addIndex(ValueExtractor, bool, Comparator)
virtual void removeIndex | ( | ValueExtractor::View | vExtractor | ) | [virtual] |
If isCacheValues() is true, the index will be removed locally, however, this call will not cause the index on the NamedCache this ContinuousQueryCache wraps.
Developers must remove the index on the wrapped cache manually.
virtual Filter::View mergeFilter | ( | Filter::View | vFilter | ) | const [protected, virtual] |
Return a filter which merges the ContinousQueueCache's filter with the supplied filter.
vFilter | the filter to merge with this cache's filter |
virtual void checkReadOnly | ( | ) | const [protected, virtual] |
Check the read-only setting to verify that the cache is NOT read-only.
IllegalStateException | if the ContinuousQueryCache is read-only |
virtual void checkEntry | ( | Map::Entry::View | vEntry | ) | [protected, virtual] |
Check the passed value to verify that it does belong in this ContinuousQueryCache.
vEntry | a key value pair to check. |
IllegalArgumentException | if the entry does not belong in this ContinuousQueryCache (based on the cache's filter) |
virtual void checkEntry | ( | Object::View | vKey, | |
Object::Holder | ohValue | |||
) | [protected, virtual] |
Check the passed value to verify that it does belong in this ContinuousQueryCache.
vKey | the key for the entry | |
ohValue | the value for the entry |
IllegalArgumentException | if the entry does not belong in this ContinuousQueryCache (based on the cache's filter) |
virtual String::View getStateString | ( | int32_t | nState | ) | const [protected, virtual] |
Return a String description of the provided STATE_* variables.
nState | the state for which a description will be returned |
IllegalStateException | if an unknown state is provided |
virtual void configureSynchronization | ( | bool | fReload | ) | const [protected, virtual] |
Set up the listeners that keep the ContinuousQueryCache up-to-date.
fReload | pass true to force a data reload |
virtual RuntimeException::View createUnexpectedStateException | ( | int32_t | nExpectedState, | |
int32_t | nActualState | |||
) | const [protected, virtual] |
Simple helper to create an exception for communicating invalid state transitions.
nExpectedState | expected state | |
nActualState | actual state |
virtual Filter::View createTransformerFilter | ( | MapEventFilter::View | vFilterAdd | ) | const [protected, virtual] |
Wrap specified MapEventFilter with a MapEventTransformerFilter that will either transform cache value using transformer defined for this ContinuousQueryCache, or remove the old value from the event using SemiLiteEventTransformer, if no transformer is defined for this CQC.
filterAdd | add filter to wrap |
virtual void ensureSynchronized | ( | bool | fReload | ) | const [protected, virtual] |
Ensure that the ContinousQueryCache listeners have been registered and its content synchronized with the underlying NamedCache.
fReload | the value to pass to the configureSynchronization method if the ContinousQueryCache needs to be configured and synchronized |
virtual bool isEventDeferred | ( | Object::View | vKey | ) | const [protected, virtual] |
Called when an event has occurred.
Allows the key to be logged as requiring deferred synchronization if the event occurs during the configuration or population of the ContinuousQueryCache.
vKey | the key that the event is related to |
virtual bool removeBlind | ( | Object::View | vKey | ) | [protected, virtual] |
Removes the mapping for this key from this map if present.
This method exists to allow sub-classes to optmiize remove functionalitly for situations in which the original value is not required.
vKey | key whose mapping is to be removed from the map |
virtual Set::View getInternalKeySet | ( | ) | const [protected, virtual] |
Obtain a set of keys that are represented by this Map.
virtual NamedCache::Handle getCacheInternal | ( | ) | const [protected, virtual] |
virtual MapListener::Handle instantiateAddListener | ( | ) | const [protected, virtual] |
Factory Method: Instantiate a MapListener for adding items to the query, and (if there are listeners on the ContinuousQueryCache) for dispatching inserts and updates.
virtual MapListener::Handle instantiateRemoveListener | ( | ) | const [protected, virtual] |
Factory Method: Instantiate a MapListener for evicting items from the query.
virtual void registerServiceListener | ( | ) | const [protected, virtual] |
Instantiate and register a MemberListener with the underlying caches's service.
The primary goal of that listener is invalidation of the front map in case of the service [automatic] restart.
virtual ObservableMap::Handle ensureInternalCache | ( | ) | const [protected, virtual] |
Create and initialize this ContinuousQueryCache's (if not already present) internal cache.
This method is called by configureSynchronization, as such, it shouldn't be called directly. Use getInternalCache.
virtual void ensureSaneCache | ( | Collection::View | vCollKeys | ) | const [protected, virtual] |
Verify that the non-existent keys are NOT present in the underlying cache (assumption is most keys in the collection are already in the ContinuousQueryCache).
vCollKeys | the keys to check the underlying cache against. |
coherence::lang::IllegalStateException | if any of the keys in collKeys doesn't exist within the ContinuousQueryCache |
virtual void registerDeactivationListener | ( | ) | const [protected, virtual] |
virtual void unregisterDeactivationListener | ( | ) | const [protected, virtual] |
virtual void releaseListeners | ( | ) | const [protected, virtual] |
Release the listeners.
virtual MultiplexingMapListener::Handle instantiateEventRouter | ( | MapListener::Handle | hListener, | |
bool | fLite | |||
) | const [protected, virtual] |
Factory Method: Instantiate a listener on the internal map that will direct events to the passed listener, either synchronously or asynchronously as appropriate.
hListener | the listener to route to | |
fLite | true to indicate that the MapEvent objects do not have to include the OldValue and NewValue property values in order to allow optimizations |
virtual TaskDaemon::Handle instantiateEventQueue | ( | ) | const [protected, virtual] |
Create a self-processing event queue.
virtual TaskDaemon::Handle getEventQueue | ( | ) | const [protected, virtual] |
Obtain this ContinuousQueryCache's event queue.
virtual TaskDaemon::Handle ensureEventQueue | ( | ) | const [protected, virtual] |
Obtain the existing event queue or create one if none exists.
virtual Set::Handle instantiateKeySet | ( | ) | [protected, virtual] |
Create a new key set.
virtual Set::Handle instantiateEntrySet | ( | ) | [protected, virtual] |
Create a new EntrySet.
virtual Map::Handle ensureIndexMap | ( | ) | [protected, virtual] |
virtual Map::View getIndexMap | ( | ) | const [protected, virtual] |
virtual Map::Handle getIndexMap | ( | ) | [protected, virtual] |
const int32_t state_disconnected [static] |
State: Disconnected state.
The content of the ContinousQueryCache is not fully synchronized with the underlying [clustered] cache. If the value of the ReconnectInterval property is zero, it must be configured (synchronized) before it can be used.
The name of the underlying NamedCache.
A copy is kept here because the reference to the underlying NamedCache is discarded when this cache is released.
State of the ContinousQueryCache.
One of the STATE_* enums.
FinalHandle<Map> f_hMapIndex [protected] |
The map of indexes maintained by this cache.
The keys of the Map are ValueExtractor objects, and for each key, the corresponding value stored in the Map is a MapIndex object.
FinalView<Supplier> f_vCacheSupplier [protected] |
The Supplier of the NamedCache to create a view of.
The Supplier must return a new instance every time the supplier's get() method is called.
MemberView<Supplier> m_vCacheNameSupplier [protected] |
The optional supplier to obtain this cache's name.
MemberHandle<MapListener> m_hListenerDeactivation [mutable, protected] |