|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tangosol.util.Base
com.tangosol.util.AbstractKeyBasedMap
com.tangosol.util.AbstractKeySetBasedMap
com.tangosol.util.WrapperObservableMap
com.tangosol.util.WrapperConcurrentMap
com.tangosol.net.cache.WrapperNamedCache
public class WrapperNamedCache
A simple implementation of NamedCache interface built as a wrapper around any Map implementation.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.tangosol.util.WrapperConcurrentMap |
---|
WrapperConcurrentMap.Lock |
Nested classes/interfaces inherited from class com.tangosol.util.WrapperObservableMap |
---|
WrapperObservableMap.InternalListener |
Nested classes/interfaces inherited from class com.tangosol.util.AbstractKeySetBasedMap |
---|
AbstractKeySetBasedMap.EntrySet, AbstractKeySetBasedMap.KeyIterator, AbstractKeySetBasedMap.KeySet, AbstractKeySetBasedMap.ValuesCollection |
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 CacheService |
m_service
The CacheService this NamedCache is a part of. |
protected String |
m_sName
The name of the cache. |
Fields inherited from class com.tangosol.util.WrapperConcurrentMap |
---|
m_cWaitMillis, m_fEnforceLocking, m_gateMap, m_mapLock |
Fields inherited from class com.tangosol.util.WrapperObservableMap |
---|
m_listenerInternal, m_listenerSupport, m_map, m_stats |
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 | |
---|---|
WrapperNamedCache(Map map,
String sName)
Construct a NamedCache wrapper based on the specified map. |
|
WrapperNamedCache(Map map,
String sName,
CacheService service)
Construct a NamedCache wrapper based on the specified map. |
Method Summary | |
---|---|
void |
addIndex(ValueExtractor extractor,
boolean fOrdered,
Comparator comparator)
Add an index to this QueryMap. |
Object |
aggregate(Collection collKeys,
InvocableMap.EntryAggregator agent)
Perform an aggregating operation against the entries specified by the passed keys. |
Object |
aggregate(Filter filter,
InvocableMap.EntryAggregator agent)
Perform an aggregating operation against the set of entries that are selected by the given Filter. |
void |
destroy()
Release and destroy this instance of NamedCache. |
Set |
entrySet(Filter filter)
Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter. |
Set |
entrySet(Filter filter,
Comparator comparator)
Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter. |
Map |
getAll(Collection colKeys)
Get all the specified keys, if they are in the Map. |
String |
getCacheName()
Return the cache name. |
CacheService |
getCacheService()
Return the CacheService that this NamedCache is a part of. |
Object |
invoke(Object oKey,
InvocableMap.EntryProcessor agent)
Invoke the passed EntryProcessor against the Entry specified by the passed key, returning the result of the invocation. |
Map |
invokeAll(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. |
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. |
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. |
Object |
put(Object oKey,
Object oValue,
long cMillis)
Associates the specified value with the specified key in this cache. |
void |
release()
Release local resources associated with this instance of NamedCache. |
void |
removeIndex(ValueExtractor extractor)
Remove an index from this QueryMap. |
Methods inherited from class com.tangosol.util.WrapperConcurrentMap |
---|
clear, getDescription, getLockDescription, getWaitMillis, instantiateLock, isInternalKeySetIteratorMutable, isLockingEnforced, lock, lock, put, putAll, remove, removeBlind, setLockingEnforced, setWaitMillis, toString, unlock |
Methods inherited from class com.tangosol.util.WrapperObservableMap |
---|
addMapListener, addMapListener, addMapListener, containsValue, dispatchEvent, dispatchPendingEvent, get, getCacheStatistics, getInternalKeySet, getMap, getMapListenerSupport, hasListeners, instantiateInternalListener, isCollectStats, isEventFabricator, isSynthetic, isTranslateEvents, removeMapListener, removeMapListener, removeMapListener, setCollectStats, setTranslateEvents |
Methods inherited from class com.tangosol.util.AbstractKeySetBasedMap |
---|
containsKey, instantiateEntrySet, instantiateKeyIterator, instantiateKeySet, instantiateValues, isEmpty, iterateKeys, size |
Methods inherited from class com.tangosol.util.AbstractKeyBasedMap |
---|
clone, entrySet, equals, hashCode, keySet, values |
Methods inherited from interface com.tangosol.net.cache.CacheMap |
---|
put |
Methods inherited from interface com.tangosol.util.ConcurrentMap |
---|
clear, containsKey, containsValue, get, isEmpty, lock, lock, put, putAll, remove, size, unlock |
Field Detail |
---|
protected String m_sName
protected CacheService m_service
Constructor Detail |
---|
public WrapperNamedCache(Map map, String sName)
Note: it is assumed that while the WrapperNamedCache exists, there is no direct manipulation with the content of the wrapped map.
map
- the Map that will be wrapped by this WrapperNamedCachesName
- the cache namepublic WrapperNamedCache(Map map, String sName, CacheService service)
Note: it is assumed that while the WrapperNamedCache exists, there is no direct manipulation with the content of the wrapped map.
map
- the Map that will be wrapped by this WrapperNamedCachesName
- the cache name (ignored if the map is a NamedCache)service
- the cache service this NamedCache is a part of
(ignored if the map is a NamedCache)Method Detail |
---|
public 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 afterword will result in an exception.
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
CacheService.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 resources will be released.
destroy
in interface NamedCache
CacheService.destroyCache(NamedCache)
public Map getAll(Collection colKeys)
getAll
in interface CacheMap
getAll
in class AbstractKeyBasedMap
colKeys
- a collection of keys that may be in the named cache
public Object put(Object oKey, Object oValue, long cMillis)
CacheMap.put(Object oKey, Object oValue)
method allows the caller to specify an expiry (or "time to live")
for the cache entry.
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()
public Set keySet(Filter filter)
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 satisfy
public 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 satisfy
public Set entrySet(Filter filter, 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
used
ChainedComparator
public void addIndex(ValueExtractor extractor, boolean fOrdered, Comparator comparator)
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 Object invoke(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 key
public Map invokeAll(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 keys
public Map invokeAll(Filter filter, InvocableMap.EntryProcessor agent)
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 keys
public Object aggregate(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 Map
public 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 Map
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |