K
- the type of the cache entry keysV_BACK
- the type of the entry values in the back cache that is used
as the source for this ContinuousQueryCache
V_FRONT
- the type of the entry values in this ContinuousQueryCache
, which
will be the same as V_BACK
, unless a transformer
is specified
when creating this ContinuousQueryCache
public class ContinuousQueryCache<K,V_BACK,V_FRONT> extends AbstractKeySetBasedMap<K,V_FRONT> implements NamedCache<K,V_FRONT>
NamedCache
using the Coherence
Continuous Query capability.
In addition to providing an up-to-date view of the backing NamedCache
, this
class supports server-side transformation of cache values. For example, you
could create a client-side view of a cache containing Portfolio
instances that only contains the value of each portfolio:
NamedCache<String, Portfolio> cache =
CacheFactory.getTypedCache("portfolio", TypeAssertion.withoutTypeChecking());
NamedCache<String, Double> cqc = new ContinuousQueryCache<>(cache,
AlwaysFilter.INSTANCE,
Portfolio::getValue);
Modifier and Type | Class and Description |
---|---|
class |
ContinuousQueryCache.AddListener
A
MapListener for adding items to the ContinuousQueryCache . |
protected class |
ContinuousQueryCache.ConverterAsynchronousProcessor
Wraps an
AsynchronousProcessor to ensure the result of the EntryProcessor
execution is deserialized prior to passing to the provided AsynchronousProcessor. |
protected class |
ContinuousQueryCache.DeactivationListener
DeactivationListener for the underlying NamedCache.
|
protected class |
ContinuousQueryCache.EventRouter<K,V>
An EventRouter routes events from the internal cache of the
ContinuousQueryCache to the client listeners, and it can do so
asynchronously when appropriate. |
protected class |
ContinuousQueryCache.InternalMapListener
This listener allows interception of all events triggered by the the internal
ObservableMap of the ContinuousQueryCache . |
class |
ContinuousQueryCache.RemoveListener
A
MapListener for evicting items from the ContinuousQueryCache . |
protected class |
ContinuousQueryCache.ServiceListener
MemberListener for the underlying cache's service. |
AbstractKeySetBasedMap.EntrySet, AbstractKeySetBasedMap.KeyIterator, AbstractKeySetBasedMap.KeySet, AbstractKeySetBasedMap.ValuesCollection
AbstractKeyBasedMap.DeferredCacheEvent<K,V>
Base.LoggingWriter, Base.StackFrame
NamedCache.Option
QueryMap.Entry<K,V>
InvocableMap.Entry<K,V>, InvocableMap.EntryAggregator<K,V,R>, InvocableMap.EntryProcessor<K,V,R>, InvocableMap.ParallelAwareAggregator<K,V,P,R>, InvocableMap.StreamingAggregator<K,V,P,R>
Modifier and Type | Field and Description |
---|---|
protected Converter |
m_converterFromBinary
|
protected Converter |
m_converterToBinary
|
protected long |
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. |
protected TaskDaemon |
m_eventQueue
The event queue for this
ContinuousQueryCache . |
protected boolean |
m_fCacheValues
The option of whether or not to locally cache values.
|
protected Filter |
m_filter
The filter that represents the subset of information from the
underlying
NamedCache that this ContinuousQueryCache represents. |
protected MapEventFilter |
m_filterAdd
The
MapEventFilter that uses the ContinuousQueryCache's filter to
select events that would add elements to this cache's contents. |
protected MapEventFilter |
m_filterRemove
The
MapEventFilter that uses the ContinuousQueryCache's filter to
select events that would remove elements from this cache's contents. |
protected boolean |
m_fListeners
Keeps track of whether the
ContinuousQueryCache has listeners that
require this cache to cache values. |
protected boolean |
m_fReadOnly
The option to disallow modifications through this
ContinuousQueryCache
interface. |
protected long |
m_ldtConnectionTimestamp
The timestamp when the synchronization was last attempted.
|
protected MapListener<K,V_FRONT> |
m_listenerAdd
The
listener that gets information about what should be in this cache. |
protected com.tangosol.internal.net.NamedCacheDeactivationListener |
m_listenerDeactivation
The
NamedCacheDeactivationListener . |
protected MapListener<K,V_FRONT> |
m_listenerRemove
The
listener that gets information about what should be thrown out of
this cache. |
protected MemberListener |
m_listenerService
The cache service
MemberListener for the underlying NamedCache . |
protected MapListenerSupport |
m_listenerSupport
Local
listener support to allow the ContinuousQueryCache to intercept
all events dispatched by the internal ObservableMap . |
protected ClassLoader |
m_loader
The
ClassLoader to use when de-serializing/serializing keys and values. |
protected Map |
m_mapIndex
The map of indexes maintained by this cache.
|
protected MapListener<? super K,? super V_FRONT> |
m_mapListener
The optional
MapListener that may be provided during ContinuousQueryCache
construction. |
protected ObservableMap<K,V_FRONT> |
m_mapLocal
The keys that are in this
ContinuousQueryCache , and (if
m_fCacheValues is true) the corresponding values as well. |
protected Map |
m_mapSyncReq
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. |
protected int |
m_nState
State of the
ContinuousQueryCache . |
protected String |
m_sName
The name of the underlying
NamedCache . |
protected ValueExtractor<? super V_BACK,? extends V_FRONT> |
m_transformer
The transformer that should be used to convert values from the
underlying cache.
|
static int |
STATE_CONFIGURED
State: The
ContinuousQueryCache has been configured. |
static int |
STATE_CONFIGURING
State: The
ContinuousQueryCache is configuring or re-configuring its
listeners and content. |
static int |
STATE_DISCONNECTED
State: Disconnected state.
|
static int |
STATE_SYNCHRONIZED
State: The
ContinuousQueryCache has been configured and fully
synchronized. |
LOG_ALWAYS, LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_MAX, LOG_MIN, LOG_QUIET, LOG_WARN, POWER_0, POWER_G, POWER_K, POWER_M, POWER_T, UNIT_D, UNIT_H, UNIT_M, UNIT_MS, UNIT_NS, UNIT_S, UNIT_US
EXPIRY_DEFAULT, EXPIRY_NEVER
LOCK_ALL
Constructor and Description |
---|
ContinuousQueryCache(NamedCache<K,V_BACK> cache)
Create a locally materialized view of a
NamedCache using a Filter . |
ContinuousQueryCache(NamedCache<K,V_BACK> cache,
Filter filter)
Create a locally materialized view of a
NamedCache using a Filter. |
ContinuousQueryCache(NamedCache<K,V_BACK> cache,
Filter filter,
boolean fCacheValues)
Create a materialized view of a
NamedCache using a Filter. |
ContinuousQueryCache(NamedCache<K,V_BACK> cache,
Filter filter,
boolean fCacheValues,
MapListener<? super K,? super V_FRONT> listener,
ValueExtractor<? super V_BACK,? extends V_FRONT> transformer)
Construct the ContinuousQueryCache.
|
ContinuousQueryCache(NamedCache<K,V_BACK> cache,
Filter filter,
MapListener<? super K,? super V_FRONT> listener)
Create a materialized view of a
NamedCache using a Filter. |
ContinuousQueryCache(NamedCache<K,V_BACK> cache,
Filter filter,
MapListener<? super K,? super V_FRONT> listener,
ValueExtractor<? super V_BACK,? extends V_FRONT> transformer)
Create a materialized view of a
NamedCache using a Filter . |
ContinuousQueryCache(NamedCache<K,V_BACK> cache,
Filter filter,
ValueExtractor<? super V_BACK,? extends V_FRONT> transformer)
Create a locally materialized view of a
NamedCache using a Filter and
a transformer. |
ContinuousQueryCache(Supplier<NamedCache<K,V_BACK>> supplierCache)
Create a locally materialized view of a
NamedCache using a Filter . |
ContinuousQueryCache(Supplier<NamedCache<K,V_BACK>> supplierCache,
Filter filter)
Create a locally materialized view of a
NamedCache using a Filter . |
ContinuousQueryCache(Supplier<NamedCache<K,V_BACK>> supplierCache,
Filter filter,
boolean fCacheValues,
MapListener<? super K,? super V_FRONT> listener,
ValueExtractor<? super V_BACK,? extends V_FRONT> transformer,
ClassLoader loader)
Create a materialized view of a
NamedCache using a Filter . |
Modifier and Type | Method and Description |
---|---|
<T,E> void |
addIndex(ValueExtractor<? super T,? extends E> extractor,
boolean fOrdered,
Comparator<? super E> comparator)
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. |
void |
addMapListener(MapListener<? super K,? super V_FRONT> listener)
Add a standard map listener that will receive all events (inserts,
updates, deletes) that occur against the map, with the key, old-value
and new-value included.
|
void |
addMapListener(MapListener<? super K,? super V_FRONT> listener,
Filter filter,
boolean fLite)
Add a map listener that receives events based on a filter evaluation.
|
void |
addMapListener(MapListener<? super K,? super V_FRONT> listener,
K oKey,
boolean fLite)
Add a map listener for a specific key.
|
<R> R |
aggregate(Collection<? extends K> collKeys,
InvocableMap.EntryAggregator<? super K,? super V_FRONT,R> aggregator)
Perform an aggregating operation against the entries specified by the
passed keys.
|
<R> R |
aggregate(Filter filter,
InvocableMap.EntryAggregator<? super K,? super V_FRONT,R> aggregator)
Perform an aggregating operation against the set of entries that are
selected by the given Filter.
|
protected void |
changeState(int nState)
Change the state of the
ContinuousQueryCache . |
protected void |
checkEntry(Map.Entry entry)
Check the passed value to verify that it does belong in this
ContinuousQueryCache.
|
protected void |
checkEntry(Object oKey,
Object oValue)
Check the passed value to verify that it does belong in this
ContinuousQueryCache.
|
protected void |
checkReadOnly()
Check the read-only setting to verify that the cache is NOT read-only.
|
void |
clear()
Clear all key/value mappings.
|
protected void |
configureSynchronization(boolean fReload)
Set up the listeners that keep the
ContinuousQueryCache up-to-date. |
protected Filter |
createTransformerFilter(MapEventFilter filterAdd)
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
ContinuousQueryCache . |
protected RuntimeException |
createUnexpectedStateException(int nExpectedState,
int nActualState)
Simple helper to create an exception for communicating invalid state transitions.
|
void |
destroy()
Release and destroy this instance of NamedCollection.
|
protected InvocableMap.EntryProcessor |
ensureConverted(InvocableMap.EntryProcessor processor)
Wrap any
AsynchronousProcessor instances with a custom wrapper to perform
conversion of result returned by the processor. |
protected NamedCache |
ensureConverters(NamedCache cache)
Instantiate the
converters necessary to support the processing mode that this
ContinuousQueryCache will be operating under. |
protected TaskDaemon |
ensureEventQueue()
Obtain the existing event queue or create one if none exists.
|
protected Map |
ensureIndexMap()
Ensure that the map of indexes maintained by this cache exists.
|
protected V_FRONT |
ensureInflated(Object oKey,
Object oValue)
If the internal cache value associated with the provided key is
Binary ,
deserialize the value and store it back to the internal cache in its deserialized form. |
protected ObservableMap<K,V_FRONT> |
ensureInternalCache()
Create and initialize this
ContinuousQueryCache 's (if not already present) internal cache. |
protected MapListenerSupport |
ensureListenerSupport()
Configure the local
MapListenerSupport and register the intercepting
MapListener with the internal ObservableMap . |
protected void |
ensureSynchronized(boolean fReload)
Ensure that the
ContinuousQueryCache listeners have been registered
and its content synchronized with the underlying NamedCache . |
Set<Map.Entry<K,V_FRONT>> |
entrySet(Filter filter)
Return a set view of the entries contained in this map that satisfy the
criteria expressed by the filter.
|
Set<Map.Entry<K,V_FRONT>> |
entrySet(Filter filter,
Comparator comparator)
Return a set view of the entries contained in this map that satisfy the
criteria expressed by the filter.
|
protected Set<Map.Entry<K,V_FRONT>> |
entrySetInternal(Filter filter)
Return multiple values from the back cache based on a filter,
transforming them in the process if necessary.
|
protected Set<Map.Entry<K,V_FRONT>> |
entrySetInternal(Filter filter,
Comparator comparator)
Return multiple values from the back cache based on a filter,
transforming them in the process if necessary.
|
protected <T> T |
fromInternal(Object binValue)
Deserialize the provided
Binary value. |
V_FRONT |
get(Object oKey)
Returns the value to which this map maps the specified key.
|
Map<K,V_FRONT> |
getAll(Collection<? extends K> colKeys)
Get all the specified keys, if they are in the Map.
|
protected Map<K,V_FRONT> |
getAllInternal(Collection<? extends K> colKeys)
Return multiple values from the back cache, transforming them in the
process if necessary.
|
NamedCache<K,V_BACK> |
getCache()
Obtain the
NamedCache that this ContinuousQueryCache is based on. |
String |
getCacheName()
Return the cache name.
|
CacheService |
getCacheService()
Return the CacheService that this NamedCache is a part of.
|
protected static String |
getDefaultName(String sCacheName,
Filter filter,
ValueExtractor transformer)
Return the default name used by the CQC.
|
protected TaskDaemon |
getEventQueue()
Obtain this
ContinuousQueryCache 's event queue. |
Filter |
getFilter()
|
protected Map |
getIndexMap()
Get the map of indexes maintained by this cache.
|
protected V_FRONT |
getInternal(Object oKey)
Return the value from the back cache, transforming it in the process if
necessary.
|
protected ObservableMap<K,V_FRONT> |
getInternalCache()
Obtain a reference to the internal cache.
|
protected Set<K> |
getInternalKeySet()
Obtain a set of keys that are represented by this Map.
|
MapListener<? super K,? super V_FRONT> |
getMapListener()
Obtain the configured
MapListener for this ContinuousQueryCache . |
long |
getReconnectInterval()
Return the reconnection interval (in milliseconds).
|
int |
getState()
Obtain the state of the
ContinuousQueryCache . |
protected String |
getStateString(int nState)
Return a String description of the provided
STATE_* variables. |
ValueExtractor<? super V_BACK,? extends V_FRONT> |
getTransformer()
Obtain the transformer that this
ContinuousQueryCache is using to transform the results from
the underlying cache prior to storing them locally. |
protected MapListener<K,V_FRONT> |
instantiateAddListener()
Factory Method: Instantiate a
MapListener for adding items to the
ContinuousQueryCache , and (if there are listeners on the
ContinuousQueryCache ) for dispatching inserts and updates. |
protected Map<K,V_FRONT> |
instantiateConverterMap(Map<K,V_FRONT> map)
Provides out-bound conversion (i.e. conversion to values clients expect) of internal values.
|
protected TaskDaemon |
instantiateEventQueue()
Create a self-processing event queue.
|
protected ContinuousQueryCache.EventRouter<K,V_FRONT> |
instantiateEventRouter(MapListener<? super K,? super V_FRONT> listener,
boolean fLite)
Factory Method: Instantiate a listener on the internal map that will
direct events to the passed listener, either synchronously or
asynchronously as appropriate.
|
protected ObservableMap<K,V_FRONT> |
instantiateInternalCache()
Create the internal cache used by the
ContinuousQueryCache . |
protected MapListener<K,V_FRONT> |
instantiateRemoveListener()
Factory Method: Instantiate a
MapListener for evicting items from the
ContinuousQueryCache . |
protected Serializer |
instantiateSerializer()
Create a
Serializer appropriate for the mode this cache is operating under
(i.e., binary vs non-binary). |
<R> R |
invoke(K key,
InvocableMap.EntryProcessor<K,V_FRONT,R> processor)
Invoke the passed EntryProcessor against the Entry specified by the
passed key, returning the result of the invocation.
|
<R> Map<K,R> |
invokeAll(Collection<? extends K> collKeys,
InvocableMap.EntryProcessor<K,V_FRONT,R> processor)
Invoke the passed EntryProcessor against the entries specified by the
passed keys, returning the result of the invocation for each.
|
<R> Map<K,R> |
invokeAll(Filter filter,
InvocableMap.EntryProcessor<K,V_FRONT,R> processor)
Invoke the passed EntryProcessor against the set of entries that are
selected by the given Filter, returning the result of the invocation for
each.
|
boolean |
isActive()
Specifies whether or not the Releasable is active.
|
protected boolean |
isBinaryNamedCache()
Return
true if the current back cache is configured to use Binary values. |
protected boolean |
isBinaryNamedCache(NamedCache cache)
Returns
true if provided cache is configured to use the
NullImplementation classloader which means
the values to/from from the cache will be Binary . |
boolean |
isCacheValues()
Determine if this
ContinuousQueryCache caches values locally. |
boolean |
isDestroyed()
Specifies whether or not the NamedCache has been destroyed.
|
protected boolean |
isEventDeferred(Object oKey)
Called when an event has occurred.
|
protected boolean |
isObserved()
Determine if the
ContinuousQueryCache has any listeners that cannot be
served by this Map listening to lite events. |
boolean |
isReadOnly()
Determine if this
ContinuousQueryCache disallows data modification
operations. |
boolean |
isReleased()
Specifies whether or not the NamedCache has been released.
|
boolean |
isTransformed()
Determine if this
ContinuousQueryCache transforms values. |
Set<K> |
keySet(Filter filter)
Return a set view of the keys contained in this map for entries that
satisfy the criteria expressed by the filter.
|
boolean |
lock(Object oKey)
Attempt to lock the specified item and return immediately.
|
boolean |
lock(Object oKey,
long cWait)
Attempt to lock the specified item within the specified period of time.
|
protected Filter |
mergeFilter(Filter filter)
|
V_FRONT |
put(K oKey,
V_FRONT oValue)
Associates the specified value with the specified key in this map.
|
V_FRONT |
put(K oKey,
V_FRONT oValue,
long cMillis)
Associates the specified value with the specified key in this cache and
allows to specify an expiry for the cache entry.
|
void |
putAll(Map<? extends K,? extends V_FRONT> map)
Copies all of the mappings from the specified map to this map.
|
protected void |
registerDeactivationListener()
Instantiate and register a
NamedCacheDeactivationListener with the underlying cache
service. |
protected void |
registerServiceListener()
Instantiate and register a
MemberListener with the underlying cache
service. |
void |
release()
Release local resources associated with this Releasable instance.
|
protected void |
releaseIndexMap()
Release the the entire index map.
|
protected void |
releaseListeners()
Release the
listeners . |
V_FRONT |
remove(Object oKey)
Removes the mapping for this key from this map if present.
|
protected boolean |
removeBlind(Object oKey)
Removes the mapping for this key from this map if present.
|
<T,E> void |
removeIndex(ValueExtractor<? super T,? extends E> extractor)
If
isCacheValues() is true , the index will be removed locally, however, this call
will not cause the index on the NamedCache this ContinuousQueryCache wraps. |
void |
removeMapListener(MapListener<? super K,? super V_FRONT> listener)
Remove a standard map listener that previously signed up for all
events.
|
void |
removeMapListener(MapListener<? super K,? super V_FRONT> listener,
Filter filter)
Remove a map listener that previously signed up for events based on a
filter evaluation.
|
void |
removeMapListener(MapListener<? super K,? super V_FRONT> listener,
K oKey)
Remove a map listener that previously signed up for events about a
specific key.
|
protected void |
resetCacheRefs()
Reset cache references to null.
|
void |
setCacheName(String sCacheName)
Set the cache name for this
ContinuousQueryCache as returned
by getCacheName() . |
void |
setCacheValues(boolean fCacheValues)
Modify the local-caching option for the
ContinuousQueryCache . |
protected void |
setObserved(boolean fObserved)
Specify whether the
ContinuousQueryCache has any listeners that cannot
be served by this Map listening to lite events. |
void |
setReadOnly(boolean fReadOnly)
Modify the read-only option for the
ContinuousQueryCache . |
void |
setReconnectInterval(long cReconnectMillis)
Specify the reconnection interval (in milliseconds).
|
protected void |
shutdownEventQueue()
Shut down running event queue.
|
protected Binary |
toInternal(Object oValue)
Serialize the provided value into a
Binary . |
protected Map<K,V_FRONT> |
transform(Set<Map.Entry<K,V_BACK>> setIn,
ValueExtractor<? super V_BACK,? extends V_FRONT> transformer)
Transform a set of entries.
|
void |
truncate()
Removes all mappings from this map.
|
boolean |
unlock(Object oKey)
Unlock the specified item.
|
protected void |
unregisterDeactivationListener()
Unregister underlying cache service member listener.
|
protected void |
unregisterServiceListener()
Unregister underlying cache service
member listener . |
containsKey, instantiateEntrySet, instantiateKeyIterator, instantiateKeySet, instantiateValues, isEmpty, isInternalKeySetIteratorMutable, iterateKeys, size
clone, containsValue, entrySet, equals, hashCode, keySet, toString, values
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
finalize, getClass, notify, notifyAll, wait, wait, wait
as, async, async, getName, getService, view
close
compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, size, values
containsKey, containsValue, isEmpty, size
aggregate, compute, compute, computeIfAbsent, computeIfAbsent, computeIfPresent, computeIfPresent, getOrDefault, invokeAll, merge, merge, putIfAbsent, remove, replace, replace, replaceAll, replaceAll, replaceAll, replaceAll, stream, stream, stream, stream, stream, stream
public static final int STATE_DISCONNECTED
ContinuousQueryCache
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.public static final int STATE_CONFIGURING
ContinuousQueryCache
is configuring or re-configuring its
listeners and content.public static final int STATE_CONFIGURED
ContinuousQueryCache
has been configured.public static final int STATE_SYNCHRONIZED
ContinuousQueryCache
has been configured and fully
synchronized.protected String m_sName
NamedCache
. A copy is kept here because the
reference to the underlying NamedCache
is discarded when this cache is
released.protected Filter m_filter
NamedCache
that this ContinuousQueryCache
represents.protected boolean m_fCacheValues
protected ValueExtractor<? super V_BACK,? extends V_FRONT> m_transformer
protected boolean m_fReadOnly
ContinuousQueryCache
interface.protected long m_cReconnectMillis
ContinuousQueryCache
should attempt to synchronize its content with the
underlying cache in case the connection is severed.protected volatile long m_ldtConnectionTimestamp
protected ObservableMap<K,V_FRONT> m_mapLocal
ContinuousQueryCache
, and (if
m_fCacheValues
is true) the corresponding values as well.protected volatile int m_nState
ContinuousQueryCache
. One of the STATE_*
enums.protected volatile Map m_mapSyncReq
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.protected volatile TaskDaemon m_eventQueue
ContinuousQueryCache
.protected boolean m_fListeners
ContinuousQueryCache
has listeners that
require this cache to cache values.protected MapEventFilter m_filterAdd
MapEventFilter
that uses the ContinuousQueryCache's
filter to
select events that would add elements to this cache's contents.protected MapEventFilter m_filterRemove
MapEventFilter
that uses the ContinuousQueryCache's
filter to
select events that would remove elements from this cache's contents.protected MapListener<K,V_FRONT> m_listenerAdd
listener
that gets information about what should be in this cache.protected MapListener<K,V_FRONT> m_listenerRemove
listener
that gets information about what should be thrown out of
this cache.protected MemberListener m_listenerService
MemberListener
for the underlying NamedCache
.protected Map m_mapIndex
ValueExtractor
objects, and for each key, the corresponding value
stored in the Map is a MapIndex object.protected com.tangosol.internal.net.NamedCacheDeactivationListener m_listenerDeactivation
NamedCacheDeactivationListener
.protected MapListener<? super K,? super V_FRONT> m_mapListener
MapListener
that may be provided during ContinuousQueryCache
construction.protected Converter m_converterFromBinary
protected Converter m_converterToBinary
protected ClassLoader m_loader
ClassLoader
to use when de-serializing/serializing keys and values.protected MapListenerSupport m_listenerSupport
listener support
to allow the ContinuousQueryCache
to intercept
all events dispatched by the internal ObservableMap
.public ContinuousQueryCache(NamedCache<K,V_BACK> cache)
NamedCache
using a Filter
. A
materialized view is an implementation of Continuous Query exposed
through the standard NamedCache
API.
This constructor will result in a ContinuousQueryCache
that caches both
its keys and values locally.
cache
- the NamedCache
with which the view will be createdpublic ContinuousQueryCache(Supplier<NamedCache<K,V_BACK>> supplierCache)
NamedCache
using a Filter
. A
materialized view is an implementation of Continuous Query
exposed through the standard NamedCache
API.
This constructor will result in a ContinuousQueryCache
that caches both
its keys and values locally.
supplierCache
- a Supplier
that returns a NamedCache
with which the ContinuousQueryCache
will be created
The Supplier must return a new instance each time
Supplier.get()
is calledpublic ContinuousQueryCache(NamedCache<K,V_BACK> cache, Filter filter)
NamedCache
using a Filter. A
materialized view is an implementation of Continuous Query
exposed through the standard NamedCache
API.
This constructor will result in a ContinuousQueryCache
that caches both
its keys and values locally.
cache
- the NamedCache
to create a view offilter
- the filter that defines the viewpublic ContinuousQueryCache(Supplier<NamedCache<K,V_BACK>> supplierCache, Filter filter)
NamedCache
using a Filter
. A
materialized view is an implementation of Continuous Query
exposed through the standard NamedCache
API.
This constructor will result in a ContinuousQueryCache
that caches both
its keys and values locally.
supplierCache
- a Supplier
that returns a NamedCache
with which the ContinuousQueryCache
will be created
The Supplier must return a new instance each time
Supplier.get()
is calledfilter
- the Filter
that defines the viewpublic ContinuousQueryCache(NamedCache<K,V_BACK> cache, Filter filter, ValueExtractor<? super V_BACK,? extends V_FRONT> transformer)
NamedCache
using a Filter
and
a transformer. A materialized view is an implementation of
Continuous Query exposed through the standard NamedCache
API.
This constructor will result in a read-only ContinuousQueryCache that caches both its keys and transformed values locally.
cache
- the NamedCache
to create a view offilter
- the Filter
that defines the viewtransformer
- the ValueExtractor
that should be used to transform
values retrieved from the underlying NamedCache
before storing them locallypublic ContinuousQueryCache(NamedCache<K,V_BACK> cache, Filter filter, boolean fCacheValues)
NamedCache
using a Filter. A
materialized view is an implementation of Continuous Query
exposed through the standard NamedCache
API.cache
- the NamedCache
to create a view offilter
- the Filter
that defines the viewfCacheValues
- pass true
to cache both the keys and values of the
materialized view locally, or false
to only cache
the keyspublic ContinuousQueryCache(NamedCache<K,V_BACK> cache, Filter filter, MapListener<? super K,? super V_FRONT> listener)
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.cache
- the NamedCache
to create a view offilter
- the Filter
that defines the viewlistener
- a MapListener
that will receive all the events from
the ContinuousQueryCache
, including those corresponding
to its initial populationpublic ContinuousQueryCache(NamedCache<K,V_BACK> cache, Filter filter, MapListener<? super K,? super V_FRONT> listener, ValueExtractor<? super V_BACK,? extends V_FRONT> transformer)
NamedCache
using a Filter
. A
materialized view is an implementation of Continuous Query
exposed through the standard NamedCache
API.
This constructor will result in a read-only ContinuousQueryCache
that caches both its keys and transformed values locally. It will also allow
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.
cache
- the NamedCache
to create a view offilter
- the Filter
that defines the viewlistener
- a MapListener
that will receive all the events from the
ContinuousQueryCache
, including those corresponding
to its initial populationtransformer
- the ValueExtractor
that should be used to transform
values retrieved from the underlying NamedCache
before storing them locallypublic ContinuousQueryCache(NamedCache<K,V_BACK> cache, Filter filter, boolean fCacheValues, MapListener<? super K,? super V_FRONT> listener, ValueExtractor<? super V_BACK,? extends V_FRONT> transformer)
cache
- the NamedCache
to create a view offilter
- the Filter
that defines the viewfCacheValues
- pass true to cache both the keys and values of the
materialized view locally, or false to only cache
the keyslistener
- an optional MapListener
that will receive all
events starting from the initialization of the ContinuousQueryCache
transformer
- an optional ValueExtractor
that would be used to
transform values retrieved from the underlying cache
before storing them locally; if specified, this
ContinuousQueryCache
will become "read-only"public ContinuousQueryCache(Supplier<NamedCache<K,V_BACK>> supplierCache, Filter filter, boolean fCacheValues, MapListener<? super K,? super V_FRONT> listener, ValueExtractor<? super V_BACK,? extends V_FRONT> transformer, ClassLoader loader)
NamedCache
using a Filter
. A
materialized view is an implementation of Continuous Query
exposed through the standard NamedCache
API.
This constructor will result in a read-only ContinuousQueryCache
that caches both its keys and transformed values locally. It will also allow
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.
supplierCache
- a Supplier
that returns a NamedCache
with which the ContinuousQueryCache
will be created.
The Supplier must return a new instance each
time Supplier.get()
is calledfilter
- the Filter
that defines the viewfCacheValues
- pass true
to cache both the keys and values of the
materialized view locally, or false
to only cache
the keyslistener
- an optional MapListener
that will receive all
events starting from the initialization of the
ContinuousQueryCache
transformer
- an optional ValueExtractor
that would be used to
transform values retrieved from the underlying cache
before storing them locally; if specified, this
ContinuousQueryCache
will become read-onlyloader
- an optional ClassLoader
public NamedCache<K,V_BACK> getCache()
NamedCache
that this ContinuousQueryCache
is based on.NamedCache
public Filter getFilter()
Filter
that this cache uses to select its contents
from the underlying NamedCache
public ValueExtractor<? super V_BACK,? extends V_FRONT> getTransformer()
ContinuousQueryCache
is using to transform the results from
the underlying cache prior to storing them locally.ValueExtractor
that this cache uses to transform entries from the underlying cachepublic MapListener<? super K,? super V_FRONT> getMapListener()
MapListener
for this ContinuousQueryCache
.MapListener
for this ContinuousQueryCache
public boolean isCacheValues()
ContinuousQueryCache
caches values locally.true
if this object caches values locally, and false
if it
relies on the underlying NamedCache
public void setCacheValues(boolean fCacheValues)
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 Near
Cache. 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 itpublic boolean isTransformed()
ContinuousQueryCache
transforms values.true
if this ContinuousQueryCache
has been configured to transform
valuespublic boolean isReadOnly()
ContinuousQueryCache
disallows data modification
operations.true
if this ContinuousQueryCache
has been configured as
read-onlypublic void setReadOnly(boolean fReadOnly)
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 cacheprotected ObservableMap<K,V_FRONT> instantiateInternalCache()
ContinuousQueryCache
.ObservableMap
that will represent the materialized view
of the ContinuousQueryCache
protected ObservableMap<K,V_FRONT> ensureInternalCache()
ContinuousQueryCache
's (if not already present) internal cache.
This method is called by configureSynchronization(boolean)
, as such, it shouldn't be called
directly. Use getInternalCache()
.ObservableMap
functioning as this ContinuousQueryCache
's internal cacheprotected ObservableMap<K,V_FRONT> getInternalCache()
ContinuousQueryCache
, and if
isCacheValues()
is true, it also maintains the up-to-date
values corresponding to those keys.ContinuousQueryCache
protected boolean isObserved()
ContinuousQueryCache
has any listeners that cannot be
served by this Map listening to lite events.true
iff there is at least one listener
protected void setObserved(boolean fObserved)
ContinuousQueryCache
has any listeners that cannot
be served by this Map listening to lite events.fObserved
- true
iff there is at least one listener
public int getState()
ContinuousQueryCache
.STATE_
enumsprotected void changeState(int nState)
ContinuousQueryCache
.nState
- one of the STATE_
enumsprotected void resetCacheRefs()
public long getReconnectInterval()
setReconnectInterval(long)
public void setReconnectInterval(long cReconnectMillis)
cReconnectMillis
- reconnection interval (in milliseconds). A value of zero
or less means that the ContinuousQueryCache
cannot
be used when not connected.public void setCacheName(String sCacheName)
ContinuousQueryCache
as returned
by getCacheName()
.
Note: setting the cache name to be consistent with the
cache name
of
the NamedCache
this CQC is backed by will
ensure data structures that cache NamedCache
instances based upon the reported cache name would
result in an appropriate cache hit.
sCacheName
- the name this CQC should report as its
cache name
public void clear()
AbstractKeyBasedMap
public V_FRONT get(Object oKey)
AbstractKeyBasedMap
get
in interface ConcurrentMap<K,V_FRONT>
get
in interface Map<K,V_FRONT>
get
in class AbstractKeyBasedMap<K,V_FRONT>
oKey
- the key objectConcurrentMap.containsKey(Object)
public V_FRONT put(K oKey, V_FRONT oValue)
AbstractKeyBasedMap
put
in interface CacheMap<K,V_FRONT>
put
in interface ConcurrentMap<K,V_FRONT>
put
in interface Map<K,V_FRONT>
put
in class AbstractKeyBasedMap<K,V_FRONT>
oKey
- key with which the specified value is to be associatedoValue
- value to be associated with the specified keypublic void putAll(Map<? extends K,? extends V_FRONT> map)
AbstractKeyBasedMap
AbstractKeyBasedMap.put(K, V)
on this map once for each mapping in the passed map. The behavior of
this operation is unspecified if the passed map is modified while the
operation is in progress.public V_FRONT remove(Object oKey)
AbstractKeyBasedMap
remove
in interface ConcurrentMap<K,V_FRONT>
remove
in interface Map<K,V_FRONT>
remove
in class AbstractKeyBasedMap<K,V_FRONT>
oKey
- key whose mapping is to be removed from the mappublic Map<K,V_FRONT> getAll(Collection<? extends K> colKeys)
AbstractKeyBasedMap
public V_FRONT put(K oKey, V_FRONT oValue, long cMillis)
NamedCache
Note: Though NamedCache interface extends CacheMap
,
not all implementations currently support this functionality.
For example, if a cache is configured to be a replicated, optimistic or distributed cache then its backing map must be configured as a local cache. If a cache is configured to be a near cache then the front map must to be configured as a local cache and the back map must support this feature as well, typically by being a distributed cache backed by a local cache (as above.)
put
in interface CacheMap<K,V_FRONT>
put
in interface NamedCache<K,V_FRONT>
oKey
- key with which the specified value is to be associatedoValue
- value to be associated with the specified keycMillis
- the number of milliseconds until the cache entry will
expire, also referred to as the entry's "time to live";
pass CacheMap.EXPIRY_DEFAULT
to use the cache's default
time-to-live setting; pass CacheMap.EXPIRY_NEVER
to
indicate that the cache entry should never expire; this
milliseconds value is not a date/time value, such
as is returned from System.currentTimeMillis()protected boolean removeBlind(Object oKey)
removeBlind
in class AbstractKeyBasedMap<K,V_FRONT>
oKey
- key whose mapping is to be removed from the maptrue
iff the Map
changed as the result of this operationprotected Set<K> getInternalKeySet()
AbstractKeySetBasedMap
The AbstractKeySetBasedMap only utilizes the internal key set as a read-only resource.
getInternalKeySet
in class AbstractKeySetBasedMap<K,V_FRONT>
public void addMapListener(MapListener<? super K,? super V_FRONT> listener)
ObservableMap
addMapListener(listener, (Filter) null, false);
addMapListener
in interface ObservableMap<K,V_FRONT>
listener
- the MapEvent
listener to addpublic void removeMapListener(MapListener<? super K,? super V_FRONT> listener)
ObservableMap
removeMapListener(listener, (Filter) null);
removeMapListener
in interface ObservableMap<K,V_FRONT>
listener
- the listener to removepublic void addMapListener(MapListener<? super K,? super V_FRONT> listener, K oKey, boolean fLite)
ObservableMap
The listeners will receive MapEvent objects, but if fLite is passed as true, they might not contain the OldValue and NewValue properties.
To unregister the MapListener, use the
ObservableMap.removeMapListener(MapListener, Object)
method.
addMapListener
in interface ObservableMap<K,V_FRONT>
listener
- the MapEvent
listener to addoKey
- the key that identifies the entry for which to raise
eventsfLite
- true to indicate that the MapEvent
objects do
not have to include the OldValue and NewValue
property values in order to allow optimizationspublic void removeMapListener(MapListener<? super K,? super V_FRONT> listener, K oKey)
ObservableMap
removeMapListener
in interface ObservableMap<K,V_FRONT>
listener
- the listener to removeoKey
- the key that identifies the entry for which to raise
eventspublic void addMapListener(MapListener<? super K,? super V_FRONT> listener, Filter filter, boolean fLite)
ObservableMap
The listeners will receive MapEvent objects, but if fLite is passed as true, they might not contain the OldValue and NewValue properties.
To unregister the MapListener, use the
ObservableMap.removeMapListener(MapListener, Filter)
method.
addMapListener
in interface ObservableMap<K,V_FRONT>
listener
- the MapEvent
listener to addfilter
- a filter that will be passed MapEvent objects to select
from; a MapEvent will be delivered to the listener only
if the filter evaluates to true for that MapEvent (see
MapEventFilter
);
null is equivalent to a filter that alway returns truefLite
- true to indicate that the MapEvent
objects do
not have to include the OldValue and NewValue
property values in order to allow optimizationspublic void removeMapListener(MapListener<? super K,? super V_FRONT> listener, Filter filter)
ObservableMap
removeMapListener
in interface ObservableMap<K,V_FRONT>
listener
- the listener to removefilter
- the filter that was passed into the corresponding
addMapListener() callpublic Set<K> keySet(Filter filter)
QueryMap
Unlike the Map.keySet()
method, the set returned by this method may
not be backed by the map, so changes to the set may not reflected in the
map, and vice-versa.
Note: When using the Coherence Enterprise Edition or Grid Edition, the Partitioned Cache implements the QueryMap interface using the Parallel Query feature. When using Coherence Standard Edition, the Parallel Query feature is not available, resulting in lower performance for most queries, and particularly when querying large data sets.
public Set<Map.Entry<K,V_FRONT>> entrySet(Filter filter)
QueryMap
Map.Entry
.
Unlike the Map.entrySet()
method, the set returned by this method
may not be backed by the map, so changes to the set may not be reflected
in the map, and vice-versa.
Note: When using the Coherence Enterprise Edition or Grid Edition, the Partitioned Cache implements the QueryMap interface using the Parallel Query feature. When using Coherence Standard Edition, the Parallel Query feature is not available, resulting in lower performance for most queries, and particularly when querying large data sets.
public Set<Map.Entry<K,V_FRONT>> entrySet(Filter filter, Comparator comparator)
QueryMap
Map.Entry
. It is further guaranteed that its iterator
will traverse the set in such a way that the entry values come up in
ascending order, sorted by the specified Comparator or according to the
natural ordering (see Comparable
).
Unlike the Map.entrySet()
method, the set returned by this method
may not be backed by the map, so changes to the set may not be reflected
in the map, and vice-versa.
Note: When using the Coherence Enterprise Edition or Grid Edition, the Partitioned Cache implements the QueryMap interface using the Parallel Query feature. When using Coherence Standard Edition, the Parallel Query feature is not available, resulting in lower performance for most queries, and particularly when querying large data sets.
entrySet
in interface QueryMap<K,V_FRONT>
filter
- the Filter object representing the criteria that the
entries of this map should satisfycomparator
- the Comparator object which imposes an ordering on
entries in the resulting set; or null if the
entries' values natural ordering should be usedChainedComparator
public <T,E> void addIndex(ValueExtractor<? super T,? extends E> extractor, boolean fOrdered, Comparator<? super E> comparator)
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.addIndex
in interface QueryMap<K,V_FRONT>
T
- the type of the value to extract fromE
- the type of value that will be extractedextractor
- the ValueExtractor object that is used to extract an
indexable Object from a value stored in the indexed
Map. Must not be null.fOrdered
- true iff the contents of the indexed information should
be ordered; false otherwisecomparator
- the Comparator object which imposes an ordering on
entries in the indexed map; or null if the
entries' values natural ordering should be usedIllegalArgumentException
- if extractor
is an instance of
MapTriggerListener
QueryMap.addIndex(ValueExtractor, boolean, Comparator)
public <T,E> void removeIndex(ValueExtractor<? super T,? extends E> extractor)
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.removeIndex
in interface QueryMap<K,V_FRONT>
T
- the type of the value to extract fromE
- the type of value that will be extractedextractor
- the ValueExtractor object that is used to extract an
indexable Object from a value stored in the Map.QueryMap.removeIndex(ValueExtractor)
,
getCache()
public void truncate()
NamedCache
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.
truncate
in interface NamedCache<K,V_FRONT>
public <R> R invoke(K key, InvocableMap.EntryProcessor<K,V_FRONT,R> processor)
In order to invoke an entry processor on a back cache in a type-safe
manner you must use getCache()
.invoke()
instead.
invoke
in interface InvocableMap<K,V_FRONT>
R
- the type of value returned by the EntryProcessorkey
- the key to process; it is not required to exist within
the Mapprocessor
- the EntryProcessor to use to process the specified keypublic <R> Map<K,R> invokeAll(Collection<? extends K> collKeys, InvocableMap.EntryProcessor<K,V_FRONT,R> processor)
In order to invoke an entry processor on a back cache in a type-safe
manner you must use getCache()
.invokeAll()
instead.
invokeAll
in interface InvocableMap<K,V_FRONT>
R
- the type of value returned by the EntryProcessorcollKeys
- the keys to process; these keys are not required to
exist within the Mapprocessor
- the EntryProcessor to use to process the specified keyspublic <R> Map<K,R> invokeAll(Filter filter, InvocableMap.EntryProcessor<K,V_FRONT,R> processor)
Unless specified otherwise, InvocableMap implementations will perform
this operation in two steps: (1) use the filter to retrieve a matching
entry set; (2) apply the agent to every filtered entry. This algorithm
assumes that the agent's processing does not affect the result of the
specified filter evaluation, since the filtering and processing could be
performed in parallel on different threads. If this assumption does not
hold, the processor logic has to be idempotent, or at least re-evaluate
the filter. This could be easily accomplished by wrapping the processor
with the ConditionalProcessor
.
In order to invoke an entry processor on a back cache in a type-safe
manner you must use getCache()
.invokeAll()
instead.
invokeAll
in interface InvocableMap<K,V_FRONT>
R
- the type of value returned by the EntryProcessorfilter
- a Filter that results in the set of keys to be
processedprocessor
- the EntryProcessor to use to process the specified keyspublic <R> R aggregate(Collection<? extends K> collKeys, InvocableMap.EntryAggregator<? super K,? super V_FRONT,R> aggregator)
InvocableMap
aggregate
in interface InvocableMap<K,V_FRONT>
R
- the type of value returned by the EntryAggregatorcollKeys
- the Collection of keys that specify the entries within
this Map to aggregate acrossaggregator
- the EntryAggregator that is used to aggregate across
the specified entries of this Mappublic <R> R aggregate(Filter filter, InvocableMap.EntryAggregator<? super K,? super V_FRONT,R> aggregator)
InvocableMap
aggregate
in interface InvocableMap<K,V_FRONT>
R
- the type of value returned by the EntryAggregatorfilter
- the Filter that is used to select entries within this
Map to aggregate acrossaggregator
- the EntryAggregator that is used to aggregate across
the selected entries of this Mappublic boolean lock(Object oKey, long cWait)
ConcurrentMap
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 cluster member 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 ConcurrentMap.LOCK_ALL
as the oKey parameter
to indicate the map lock.
lock
in interface ConcurrentMap<K,V_FRONT>
oKey
- key being lockedcWait
- the number of milliseconds to continue trying to obtain
a lock; pass zero to return immediately; pass -1 to block
the calling thread until the lock could be obtainedpublic boolean lock(Object oKey)
ConcurrentMap
This method behaves exactly as if it simply performs the call lock(oKey, 0).
lock
in interface ConcurrentMap<K,V_FRONT>
oKey
- key being lockedpublic boolean unlock(Object oKey)
ConcurrentMap
unlock
in interface ConcurrentMap<K,V_FRONT>
oKey
- key being unlockedpublic String getCacheName()
NamedCache
getCacheName
in interface NamedCache<K,V_FRONT>
public CacheService getCacheService()
NamedCache
getCacheService
in interface NamedCache<K,V_FRONT>
public boolean isActive()
Releasable
isActive
in interface Releasable
public void release()
Releasable
release
in interface Releasable
public void destroy()
NamedCollection
Warning: This method is used to completely destroy the specified collection across the cluster. All references in the entire cluster to this collection will be invalidated, the collection data will be cleared, and all internal resources will be released.
destroy
in interface NamedCollection
public boolean isDestroyed()
NamedCache
isDestroyed
in interface NamedCache<K,V_FRONT>
public boolean isReleased()
NamedCache
isReleased
in interface NamedCache<K,V_FRONT>
protected V_FRONT getInternal(Object oKey)
oKey
- the key to get the associated value forprotected Map<K,V_FRONT> getAllInternal(Collection<? extends K> colKeys)
colKeys
- the keys to get the associated values forprotected Set<Map.Entry<K,V_FRONT>> entrySetInternal(Filter filter)
filter
- the Filter
to find the entries forprotected Set<Map.Entry<K,V_FRONT>> entrySetInternal(Filter filter, Comparator comparator)
filter
- the Filter
to find the entries forcomparator
- the Comparator
protected Map<K,V_FRONT> transform(Set<Map.Entry<K,V_BACK>> setIn, ValueExtractor<? super V_BACK,? extends V_FRONT> transformer)
setIn
- the set of entries to transformtransformer
- the transformer
to useprotected void checkReadOnly()
IllegalStateException
- if the ContinuousQueryCache
is read-onlyprotected void checkEntry(Map.Entry entry)
entry
- a key value pair to check.IllegalArgumentException
- if the entry does not belong in this
ContinuousQueryCache
(based on the cache's filter)protected void checkEntry(Object oKey, Object oValue)
oKey
- the key for the entryoValue
- the value for the entryIllegalArgumentException
- if the entry does not belong in this
ContinuousQueryCache
(based on the cache's filter)protected String getStateString(int nState)
STATE_*
variables.nState
- the state for which a description will be returnedIllegalStateException
- if an unknown state is providedprotected void configureSynchronization(boolean fReload)
ContinuousQueryCache
up-to-date.fReload
- pass true
to force a data reloadprotected RuntimeException createUnexpectedStateException(int nExpectedState, int nActualState)
nExpectedState
- expected statenActualState
- actual stateRuntimeException
with a description of the invalid state transitionprotected Filter createTransformerFilter(MapEventFilter filterAdd)
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
ContinuousQueryCache
.filterAdd
- add MapEventFilter
to wrapMapEventTransformerFilter
that wraps specified add MapEventFilter
protected void ensureSynchronized(boolean fReload)
ContinuousQueryCache
listeners have been registered
and its content synchronized with the underlying NamedCache
.fReload
- the value to pass to the #configureSynchronization
method if the ContinuousQueryCache
needs to be
configured and synchronizedprotected boolean isEventDeferred(Object oKey)
ContinuousQueryCache
.oKey
- the key that the event is related totrue
if the event processing has been deferredprotected Map ensureIndexMap()
protected Map getIndexMap()
protected void releaseIndexMap()
protected void releaseListeners()
listeners
.protected MapListener<K,V_FRONT> instantiateAddListener()
MapListener
for adding items to the
ContinuousQueryCache
, and (if there are listeners on the
ContinuousQueryCache
) for dispatching inserts and updates.MapListener
that will add items to and update items in
the ContinuousQueryCache
protected MapListener<K,V_FRONT> instantiateRemoveListener()
MapListener
for evicting items from the
ContinuousQueryCache
.MapListener
that will listen to all events that will
remove items from the ContinuousQueryCache
protected void registerServiceListener()
MemberListener
with the underlying cache
service.
The primary goal of that listener
is invalidation of the front map
in case of the service [automatic] restart.
protected void unregisterServiceListener()
member listener
.protected void registerDeactivationListener()
NamedCacheDeactivationListener
with the underlying cache
service.
The primary goal of that listener
is invalidation of the named cache
in case the named caches is destroyed / truncated.
protected void unregisterDeactivationListener()
protected ContinuousQueryCache.EventRouter<K,V_FRONT> instantiateEventRouter(MapListener<? super K,? super V_FRONT> listener, boolean fLite)
listener
- the listener
to route tofLite
- true
to indicate that the MapEvent
objects do
not have to include the OldValue and NewValue
property values in order to allow optimizationsContinuousQueryCache.EventRouter
specific to the passed listener
protected TaskDaemon instantiateEventQueue()
TaskDaemon
onto which events can be placed in order to be
dispatched asynchronouslyprotected TaskDaemon getEventQueue()
ContinuousQueryCache
's event queue.ContinuousQueryCache
uses to dispatch
its events to its non-synchronous listenersprotected TaskDaemon ensureEventQueue()
ContinuousQueryCache
uses to dispatch its events to its
non-synchronous listenersprotected void shutdownEventQueue()
protected MapListenerSupport ensureListenerSupport()
MapListenerSupport
and register the intercepting
MapListener
with the internal ObservableMap
.protected V_FRONT ensureInflated(Object oKey, Object oValue)
Binary
,
deserialize the value and store it back to the internal cache in its deserialized form.oKey
- the keyoValue
- optional original value associated with the key. If not provided, there
will be a cost of an additional call to obtain the value currently
associated with the keyprotected <T> T fromInternal(Object binValue)
Binary
value.T
- the type parameterbinValue
- the Binary
value to deserializeprotected Binary toInternal(Object oValue)
Binary
.oValue
- the object to serialize.protected Map<K,V_FRONT> instantiateConverterMap(Map<K,V_FRONT> map)
protected InvocableMap.EntryProcessor ensureConverted(InvocableMap.EntryProcessor processor)
AsynchronousProcessor
instances with a custom wrapper to perform
conversion of result returned by the processor.processor
- the EntryProcessor
EntryProcessor
to leverage when dispatching aggregation requests.protected boolean isBinaryNamedCache(NamedCache cache)
true
if provided cache is configured to use the
NullImplementation classloader
which means
the values to/from from the cache will be Binary
.cache
- the cachetrue
if the cache is configured to use the
NullImplementation classloader
protected boolean isBinaryNamedCache()
true
if the current back cache is configured to use Binary
values.true
if the back cache is configured to use Binary
valuesprotected Serializer instantiateSerializer()
Serializer
appropriate for the mode this cache is operating under
(i.e., binary vs non-binary).Serializer
protected NamedCache ensureConverters(NamedCache cache)
converters
necessary to support the processing mode that this
ContinuousQueryCache
will be operating under.cache
- the underlying cacheprotected static String getDefaultName(String sCacheName, Filter filter, ValueExtractor transformer)
sCacheName
- the cache name this CQC is backed byfilter
- the filter that reduces the set of entries of this CQCtransformer
- the transformer
to apply to the
raw entries