|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.AbstractKeyBasedMap
com.tangosol.util.AbstractKeySetBasedMap
com.tangosol.net.cache.ContinuousQueryCache
public class ContinuousQueryCache
Create a materialized view of a NamedCache using the Coherence Continuous Query capability.
Nested Class Summary | |
---|---|
class |
ContinuousQueryCache.AddListener A MapListener for adding items to the ContinuousQueryCache. |
protected class |
ContinuousQueryCache.EventRouter An EventRouter routes events from the internal cache of the ContinuousQueryCache to the client listeners, and it can do so asynchronously when appropriate. |
class |
ContinuousQueryCache.RemoveListener A MapListener for evicting items from the ContinuousQueryCache. |
protected class |
ContinuousQueryCache.ServiceListener MemberListener for the underlying cache's service. |
Nested classes/interfaces inherited from class com.tangosol.util.AbstractKeySetBasedMap |
---|
AbstractKeySetBasedMap.EntrySet, AbstractKeySetBasedMap.KeyIterator, AbstractKeySetBasedMap.KeySet, AbstractKeySetBasedMap.ValuesCollection |
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry |
Nested classes/interfaces inherited from interface com.tangosol.util.QueryMap |
---|
QueryMap.Entry |
Nested classes/interfaces inherited from interface com.tangosol.util.InvocableMap |
---|
InvocableMap.Entry, InvocableMap.EntryAggregator, InvocableMap.EntryProcessor, InvocableMap.ParallelAwareAggregator |
Field Summary | |
---|---|
protected long |
m_ldtConnectionTimestamp The timestamp when the synchronization was last attempted. |
protected MemberListener |
m_listenerService The cache service MemberListener for the underlying NamedCache. |
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. |
Fields inherited from interface com.tangosol.net.cache.CacheMap |
---|
EXPIRY_DEFAULT, EXPIRY_NEVER |
Fields inherited from interface com.tangosol.util.ConcurrentMap |
---|
LOCK_ALL |
Constructor Summary | |
---|---|
|
ContinuousQueryCache(NamedCache cache, Filter filter) Create a locally materialized view of a NamedCache using a Filter. |
|
ContinuousQueryCache(NamedCache cache, Filter filter, boolean fCacheValues) Create a materialized view of a NamedCache using a Filter. |
protected |
ContinuousQueryCache(NamedCache cache, Filter filter, boolean fCacheValues, MapListener listener, ValueExtractor transformer) Construct the ContinuousQueryCache. |
|
ContinuousQueryCache(NamedCache cache, Filter filter, MapListener listener) Create a materialized view of a NamedCache using a Filter. |
|
ContinuousQueryCache(NamedCache cache, Filter filter, ValueExtractor transformer) Create a locally materialized view of a NamedCache using a Filter and a transformer. |
Method Summary | |
---|---|
void |
addIndex(ValueExtractor extractor, boolean fOrdered, java.util.Comparator comparator) Add an index to this QueryMap. |
void |
addMapListener(MapListener 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 listener, Filter filter, boolean fLite) Add a map listener that receives events based on a filter evaluation. |
void |
addMapListener(MapListener listener, java.lang.Object oKey, boolean fLite) Add a map listener for a specific key. |
java.lang.Object |
aggregate(java.util.Collection collKeys, InvocableMap.EntryAggregator agent) Perform an aggregating operation against the entries specified by the passed keys. |
java.lang.Object |
aggregate(Filter filter, InvocableMap.EntryAggregator agent) 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(java.util.Map.Entry entry) Check the passed value to verify that it does belong in this ContinuousQueryCache. |
protected void |
checkEntry(java.lang.Object oKey, java.lang.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 CQC. |
void |
destroy() Release and destroy this instance of NamedCache. |
protected TaskDaemon |
ensureEventQueue() Obtain the existing event queue or create one if none exists. |
protected java.util.Map |
ensureIndexMap() Ensure that the map of indexes maintained by this cache exists. |
protected void |
ensureSynchronized(boolean fReload) Ensure that the ContinuousQueryCache listeners have been registered and its content synchronized with the underlying NamedCache. |
java.util.Set |
entrySet(Filter filter) Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter. |
java.util.Set |
entrySet(Filter filter, java.util.Comparator comparator) Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter. |
java.lang.Object |
get(java.lang.Object oKey) Returns the value to which this map maps the specified key. |
java.util.Map |
getAll(java.util.Collection colKeys) Get all the specified keys, if they are in the Map. |
NamedCache |
getCache() Obtain the NamedCache that this ContinuousQueryCache is based on. |
java.lang.String |
getCacheName() Return the cache name. |
CacheService |
getCacheService() Return the CacheService that this NamedCache is a part of. |
protected TaskDaemon |
getEventQueue() Obtain this ContinuousQueryCache's event queue. |
Filter |
getFilter() Obtain the Filter that this ContinuousQueryCache is using to query the underlying NamedCache. |
protected java.util.Map |
getIndexMap() Get the map of indexes maintained by this cache. |
protected ObservableMap |
getInternalCache() Obtain a reference to the internal cache. |
protected java.util.Set |
getInternalKeySet() Obtain a set of keys that are represented by this Map. |
long |
getReconnectInterval() Return a reconnection interval (in milliseconds). |
int |
getState() Obtain the state of the ContinuousQueryCache. |
protected MapListener |
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 TaskDaemon |
instantiateEventQueue() Create a self-processing event queue. |
protected ContinuousQueryCache.EventRouter |
instantiateEventRouter(MapListener listener) 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 |
instantiateInternalCache() Create the internal cache used by the ContinuousQueryCache. |
protected MapListener |
instantiateRemoveListener() Factory Method: Instantiate a MapListener for evicting items from the ContinuousQueryCache. |
java.lang.Object |
invoke(java.lang.Object oKey, InvocableMap.EntryProcessor agent) Invoke the passed EntryProcessor against the Entry specified by the passed key, returning the result of the invocation. |
java.util.Map |
invokeAll(java.util.Collection collKeys, InvocableMap.EntryProcessor agent) Invoke the passed EntryProcessor against the entries specified by the passed keys, returning the result of the invocation for each. |
java.util.Map |
invokeAll(Filter filter, InvocableMap.EntryProcessor agent) 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 NamedCache is active. |
boolean |
isCacheValues() Determine if this ContinuousQueryCache caches values locally. |
protected boolean |
isEventDeferred(java.lang.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. |
java.util.Set |
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(java.lang.Object oKey) Attempt to lock the specified item and return immediately. |
boolean |
lock(java.lang.Object oKey, long cWait) Attempt to lock the specified item within the specified period of time. |
protected Filter |
mergeFilter(Filter filter) Return a filter which merges the ContinuousQueueCache's filter with the supplied filter. |
java.lang.Object |
put(java.lang.Object oKey, java.lang.Object oValue) Associates the specified value with the specified key in this map. |
java.lang.Object |
put(java.lang.Object oKey, java.lang.Object 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(java.util.Map map) Copies all of the mappings from the specified map to this map. |
protected void |
registerServiceListener() Instantiate and register a MemberListener with the underlying cache service. |
void |
release() Release local resources associated with this instance of NamedCache. |
protected void |
releaseIndexMap() Release the the entire index map. |
java.lang.Object |
remove(java.lang.Object oKey) Removes the mapping for this key from this map if present. |
protected boolean |
removeBlind(java.lang.Object oKey) Removes the mapping for this key from this map if present. |
void |
removeIndex(ValueExtractor extractor) Remove an index from this QueryMap. |
void |
removeMapListener(MapListener listener) Remove a standard map listener that previously signed up for all events. |
void |
removeMapListener(MapListener listener, Filter filter) Remove a map listener that previously signed up for events based on a filter evaluation. |
void |
removeMapListener(MapListener listener, java.lang.Object oKey) Remove a map listener that previously signed up for events about a specific key. |
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 a reconnection interval (in milliseconds). |
protected void |
shutdownEventQueue() Shut down running event queue. |
boolean |
unlock(java.lang.Object oKey) Unlock the specified item. |
protected void |
unregisterServiceListener() Unregister underlying cache service member listener. |
Methods inherited from class com.tangosol.util.AbstractKeySetBasedMap |
---|
containsKey, instantiateEntrySet, instantiateKeyIterator, instantiateKeySet, instantiateValues, isEmpty, isInternalKeySetIteratorMutable, iterateKeys, size |
Methods inherited from class com.tangosol.util.AbstractKeyBasedMap |
---|
clone, containsValue, entrySet, equals, hashCode, keySet, toString, values |
Methods inherited from interface java.util.Map |
---|
containsKey, containsValue, entrySet, equals, hashCode, isEmpty, keySet, size, values |
Methods inherited from interface com.tangosol.util.ConcurrentMap |
---|
containsKey, containsValue, isEmpty, size |
Field Detail |
---|
public static final int STATE_DISCONNECTED
public static final int STATE_CONFIGURING
public static final int STATE_CONFIGURED
public static final int STATE_SYNCHRONIZED
protected volatile long m_ldtConnectionTimestamp
protected MemberListener m_listenerService
Constructor Detail |
---|
public ContinuousQueryCache(NamedCache cache, Filter filter)
cache
- the NamedCache to create a view offilter
- the filter that defines the viewpublic ContinuousQueryCache(NamedCache cache, Filter filter, ValueExtractor transformer)
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 cache, Filter filter, boolean fCacheValues)
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 cache, Filter filter, MapListener listener)
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 populationprotected ContinuousQueryCache(NamedCache cache, Filter filter, boolean fCacheValues, MapListener listener, ValueExtractor 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 ContinuousQueryCachetransformer
- 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"Method Detail |
---|
public NamedCache getCache()
public Filter getFilter()
Filter
that this cache uses to select its contents from the underlying NamedCachepublic boolean isCacheValues()
public void setCacheValues(boolean fCacheValues)
This method is not yet implemented.
fCacheValues
- pass true to enable local caching, or false to disable itpublic boolean isReadOnly()
public void setReadOnly(boolean fReadOnly)
fReadOnly
- pass true to prohibit clients from making modifications to this cacheprotected ObservableMap instantiateInternalCache()
protected ObservableMap getInternalCache()
isCacheValues()
is true, it also maintains the up-to-date values corresponding to those keys.protected boolean isObserved()
protected void setObserved(boolean fObserved)
fObserved
- true iff there is at least one listenerpublic int getState()
protected void changeState(int nState)
nState
- one of the STATE_ enumspublic long getReconnectInterval()
setReconnectInterval(long)
public void setReconnectInterval(long cReconnectMillis)
cReconnectMillis
- reconnection interval (in milliseconds). The value of zero means that the ContinuousQueryCache cannot be used when not connected. If the value is positive, the local content could be accessed (read-only) even if connection is severed.public void clear()
clear
in interface ConcurrentMap
clear
in interface java.util.Map
clear
in class AbstractKeyBasedMap
public java.lang.Object get(java.lang.Object oKey)
get
in interface ConcurrentMap
get
in interface java.util.Map
get
in class AbstractKeyBasedMap
oKey
- the key objectConcurrentMap.containsKey(Object)
public java.lang.Object put(java.lang.Object oKey, java.lang.Object oValue)
put
in interface CacheMap
put
in interface ConcurrentMap
put
in interface java.util.Map
put
in class AbstractKeyBasedMap
oKey
- key with which the specified value is to be associatedoValue
- value to be associated with the specified keypublic void putAll(java.util.Map map)
AbstractKeyBasedMap.put(java.lang.Object, java.lang.Object)
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.putAll
in interface ConcurrentMap
putAll
in interface java.util.Map
putAll
in class AbstractKeyBasedMap
map
- the Map containing the key/value pairings to put into this Mappublic java.lang.Object remove(java.lang.Object oKey)
remove
in interface ConcurrentMap
remove
in interface java.util.Map
remove
in class AbstractKeyBasedMap
oKey
- key whose mapping is to be removed from the mappublic java.util.Map getAll(java.util.Collection colKeys)
getAll
in interface CacheMap
getAll
in class AbstractKeyBasedMap
colKeys
- a collection of keys that may be in the named cachepublic java.lang.Object put(java.lang.Object oKey, java.lang.Object oValue, long cMillis)
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
put
in interface NamedCache
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(java.lang.Object oKey)
removeBlind
in class AbstractKeyBasedMap
oKey
- key whose mapping is to be removed from the mapprotected java.util.Set getInternalKeySet()
The AbstractKeySetBasedMap only utilizes the internal key set as a read-only resource.
getInternalKeySet
in class AbstractKeySetBasedMap
public void addMapListener(MapListener listener)
addMapListener(listener, (Filter) null, false);
addMapListener
in interface ObservableMap
listener
- the MapEvent
listener to addpublic void removeMapListener(MapListener listener)
removeMapListener(listener, (Filter) null);
removeMapListener
in interface ObservableMap
listener
- the listener to removepublic void addMapListener(MapListener listener, java.lang.Object oKey, boolean fLite)
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
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 listener, java.lang.Object oKey)
removeMapListener
in interface ObservableMap
listener
- the listener to removeoKey
- the key that identifies the entry for which to raise eventspublic void addMapListener(MapListener listener, Filter filter, boolean fLite)
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
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 listener, Filter filter)
removeMapListener
in interface ObservableMap
listener
- the listener to removefilter
- the filter that was passed into the corresponding addMapListener() callpublic java.util.Set keySet(Filter filter)
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.
keySet
in interface QueryMap
filter
- the Filter object representing the criteria that the entries of this map should satisfypublic java.util.Set entrySet(Filter filter)
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.
entrySet
in interface QueryMap
filter
- the Filter object representing the criteria that the entries of this map should satisfypublic java.util.Set entrySet(Filter filter, java.util.Comparator comparator)
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
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 void addIndex(ValueExtractor extractor, boolean fOrdered, java.util.Comparator comparator)
The ordering maintained by this map (as determined by either the specified Comparator or the natural ordering of the indexed values) must be consistent with equals (see Comparable
or Comparator
for a precise definition of consistent with equals.)
This method is only intended as a hint to the cache implementation, and as such it may be ignored by the cache if indexes are not supported or if the desired index (or a similar index) already exists. It is expected that an application will call this method to suggest an index even if the index may already exist, just so that the application is certain that index has been suggested. For example in a distributed environment, each server will likely suggest the same set of indexes when it starts, and there is no downside to the application blindly requesting those indexes regardless of whether another server has already requested the same indexes.
Note: Indexes are a feature of Coherence Enterprise Edition and Coherence Grid Edition. This method will have no effect when using Coherence Standard Edition.
addIndex
in interface QueryMap
extractor
- 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 usedReflectionExtractor
, ChainedComparator
public void removeIndex(ValueExtractor extractor)
removeIndex
in interface QueryMap
extractor
- the ValueExtractor object that is used to extract an indexable Object from a value stored in the Map.public java.lang.Object invoke(java.lang.Object oKey, InvocableMap.EntryProcessor agent)
invoke
in interface InvocableMap
oKey
- the key to process; it is not required to exist within the Mapagent
- the EntryProcessor to use to process the specified keypublic java.util.Map invokeAll(java.util.Collection collKeys, InvocableMap.EntryProcessor agent)
invokeAll
in interface InvocableMap
collKeys
- the keys to process; these keys are not required to exist within the Mapagent
- the EntryProcessor to use to process the specified keyspublic java.util.Map invokeAll(Filter filter, InvocableMap.EntryProcessor agent)
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
.
invokeAll
in interface InvocableMap
filter
- a Filter that results in the set of keys to be processedagent
- the EntryProcessor to use to process the specified keyspublic java.lang.Object aggregate(java.util.Collection collKeys, InvocableMap.EntryAggregator agent)
aggregate
in interface InvocableMap
collKeys
- the Collection of keys that specify the entries within this Map to aggregate acrossagent
- the EntryAggregator that is used to aggregate across the specified entries of this Mappublic java.lang.Object aggregate(Filter filter, InvocableMap.EntryAggregator agent)
aggregate
in interface InvocableMap
filter
- the Filter that is used to select entries within this Map to aggregate acrossagent
- the EntryAggregator that is used to aggregate across the selected entries of this Mappublic boolean lock(java.lang.Object oKey, long cWait)
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
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(java.lang.Object oKey)
This method behaves exactly as if it simply performs the call lock(oKey, 0).
lock
in interface ConcurrentMap
oKey
- key being lockedpublic boolean unlock(java.lang.Object oKey)
unlock
in interface ConcurrentMap
oKey
- key being unlockedpublic java.lang.String getCacheName()
getCacheName
in interface NamedCache
public CacheService getCacheService()
getCacheService
in interface NamedCache
public boolean isActive()
isActive
in interface NamedCache
public void release()
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:
The purpose for releasing a cache is to allow the cache implementation to release the ClassLoader used to deserialize items in the cache. The cache implementation ensures that all references to that ClassLoader are released. This implies that objects in the cache that were loaded by that ClassLoader will be re-serialized to release their hold on that ClassLoader. The result is that the ClassLoader can be garbage-collected by Java in situations where the cache is operating in an application server and applications are dynamically loaded and unloaded.
release
in interface NamedCache
CacheFactory.releaseCache(NamedCache)
, ConfigurableCacheFactory.releaseCache(NamedCache)
public void destroy()
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 internal resources will be released.
Caches should be destroyed by the same mechanism in which they were obtained. For example:
destroy
in interface NamedCache
CacheFactory.destroyCache(NamedCache)
, ConfigurableCacheFactory.destroyCache(NamedCache)
protected Filter mergeFilter(Filter filter)
filter
- the filter to merge with this cache's filterprotected void checkReadOnly()
java.lang.IllegalStateException
- if the ContinuousQueryCache is read-onlyprotected void checkEntry(java.util.Map.Entry entry)
entry
- a key value pair to check.java.lang.IllegalArgumentException
- if the entry does not belong in this ContinuousQueryCache (based on the cache's filter)protected void checkEntry(java.lang.Object oKey, java.lang.Object oValue)
oKey
- the key for the entryoValue
- the value for the entryjava.lang.IllegalArgumentException
- if the entry does not belong in this ContinuousQueryCache (based on the cache's filter)protected void configureSynchronization(boolean fReload)
fReload
- pass true to force a data reloadprotected Filter createTransformerFilter(MapEventFilter filterAdd)
filterAdd
- add filter to wrapprotected void ensureSynchronized(boolean fReload)
fReload
- the value to pass to the #configureSynchronization method if the ContinuousQueryCache needs to be configured and synchronizedprotected boolean isEventDeferred(java.lang.Object oKey)
oKey
- the key that the event is related toprotected java.util.Map ensureIndexMap()
protected java.util.Map getIndexMap()
protected void releaseIndexMap()
protected MapListener instantiateAddListener()
protected MapListener instantiateRemoveListener()
protected void registerServiceListener()
The primary goal of that listener is invalidation of the front map in case of the service [automatic] restart.
protected void unregisterServiceListener()
protected ContinuousQueryCache.EventRouter instantiateEventRouter(MapListener listener)
listener
- the listener to route toprotected TaskDaemon instantiateEventQueue()
protected TaskDaemon getEventQueue()
protected TaskDaemon ensureEventQueue()
protected void shutdownEventQueue()
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |