Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.util
Class ConverterCollections.ConverterNamedCache

`java.lang.Object
com.tangosol.util.Base
com.tangosol.util.ConverterCollections.ConverterMap
com.tangosol.util.ConverterCollections.ConverterObservableMap
com.tangosol.util.ConverterCollections.ConverterCacheMap
com.tangosol.util.ConverterCollections.ConverterNamedCache`

All Implemented Interfaces:
  CacheMap, NamedCache, ConcurrentMap, InvocableMap, ObservableMap, QueryMap, java.io.Serializable, java.util.Map

Enclosing class:
  ConverterCollections

      public static class ConverterCollections.ConverterNamedCache

extends ConverterCollections.ConverterCacheMap
implements NamedCache, java.io.Serializable

A Converter NamedCache views an underlying NamedCache through a set of key and value Converters.

Nested Class Summary

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 ConverterCollections.ConverterConcurrentMap` | `m_mapConcurrent` A Converter ConcurrentMap around the underlying NamedCache.
`protected ConverterCollections.ConverterInvocableMap` | `m_mapInvocable` A Converter InvocableMap around the underlying NamedCache.
`protected ConverterCollections.ConverterQueryMap` | `m_mapQuery` A Converter QueryMap around the underlying NamedCache.

Fields inherited from class com.tangosol.util.ConverterCollections.ConverterMap
`m_convKeyDown, m_convKeyUp, m_convValDown, m_convValUp, m_map, m_set`

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
`ConverterCollections.ConverterNamedCache(NamedCache cache, Converter convKeyUp, Converter convKeyDown, Converter convValUp, Converter convValDown)` Constructor.

Method Summary
`void` | `addIndex(ValueExtractor extractor, boolean fOrdered, java.util.Comparator comparator)` Add an index to this QueryMap.
`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.
`void` | `destroy()` Release and destroy this instance of 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.String` | `getCacheName()` Return the cache name.
`CacheService` | `getCacheService()` Return the CacheService that this NamedCache is a part of.
`NamedCache` | `getNamedCache()` Return the underlying NamedCache.
`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.
`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.
`void` | `release()` Release local resources associated with this instance of NamedCache.
`void` | `removeIndex(ValueExtractor extractor)` Remove an index from this QueryMap.
`boolean` | `unlock(java.lang.Object oKey)` Unlock the specified item.

Methods inherited from class com.tangosol.util.ConverterCollections.ConverterCacheMap
`getAll, getCacheMap, put`

Methods inherited from class com.tangosol.util.ConverterCollections.ConverterObservableMap
`addMapListener, addMapListener, addMapListener, getConverterListener, getObservableMap, removeMapListener, removeMapListener, removeMapListener`

Methods inherited from class com.tangosol.util.ConverterCollections.ConverterMap
`clear, containsKey, containsValue, entrySet, get, getConverterKeyDown, getConverterKeyUp, getConverterValueDown, getConverterValueUp, getMap, instantiateCollection, instantiateEntrySet, instantiateMap, instantiateSet, isEmpty, keySet, put, putAll, remove, size, toString, values`

Methods inherited from interface com.tangosol.net.NamedCache
`put`

Methods inherited from interface com.tangosol.net.cache.CacheMap
`getAll, put`

Methods inherited from interface com.tangosol.util.ConcurrentMap
`clear, containsKey, containsValue, get, isEmpty, put, putAll, remove, size`

Field Detail

### m_mapConcurrent

    protected ConverterCollections.ConverterConcurrentMap m_mapConcurrent

  A Converter ConcurrentMap around the underlying NamedCache.

### m_mapInvocable

    protected ConverterCollections.ConverterInvocableMap m_mapInvocable

  A Converter InvocableMap around the underlying NamedCache.

### m_mapQuery

    protected ConverterCollections.ConverterQueryMap m_mapQuery

  A Converter QueryMap around the underlying NamedCache.

Constructor Detail

### ConverterCollections.ConverterNamedCache

    public ConverterCollections.ConverterNamedCache(NamedCache cache,
                                                    Converter convKeyUp,
                                                    Converter convKeyDown,
                                                    Converter convValUp,
                                                    Converter convValDown)

  Constructor.
  Parameters:
    `cache` - the underlying NamedCache
    `convKeyUp` - the Converter to view the underlying NamedCache's keys through
    `convKeyDown` - the Converter to use to pass keys down to the underlying NamedCache
    `convValUp` - the Converter to view the underlying NamedCache's values through
    `convValDown` - the Converter to use to pass values down to the underlying NamedCache

Method Detail

### getCacheName

    public java.lang.String getCacheName()

  Return the cache name.
  Specified by:
    `getCacheName` in interface `NamedCache`
  Returns:
    the cache name

### getCacheService

    public CacheService getCacheService()

  Return the CacheService that this NamedCache is a part of.
  Specified by:
    `getCacheService` in interface `NamedCache`
  Returns:
    the CacheService

### isActive

    public boolean isActive()

  Specifies whether or not the NamedCache is active.
  Specified by:
    `isActive` in interface `NamedCache`
  Returns:
    true if the NamedCache is active; false otherwise

### release

    public void release()

  Release local resources associated with this instance of NamedCache.

  Releasing a cache makes it no longer usable, but does not affect the cache itself. In other words, all other references to the cache will still be valid, and the cache data is not affected by releasing the reference. Any attempt to use this reference afterward will result in an exception.

  Caches should be released by the same mechanism in which they were obtained. For example:

  - new Cache() - cache.release()
  - CacheFactory.getCache() - CacheFactory.releaseCache()
  - ConfigurableCacheFactory.ensureCache() - ConfigurableCacheFactory.releaseCache()
  Except for the case where the application code explicitly allocated the cache, this method should not be called by application code.

  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.

  Specified by:
    `release` in interface `NamedCache`
  See Also:
    `CacheFactory.releaseCache(NamedCache)`, `ConfigurableCacheFactory.releaseCache(NamedCache)`

### destroy

    public void destroy()

  Release and destroy this instance of NamedCache.

  Warning: This method is used to completely destroy the specified cache across the cluster. All references in the entire cluster to this cache will be invalidated, the cached data will be cleared, and all internal resources will be released.

  Caches should be destroyed by the same mechansim in which they were obtained. For example:

  - new Cache() - cache.destroy()
  - CacheFactory.getCache() - CacheFactory.destroyCache()
  - ConfigurableCacheFactory.ensureCache() - ConfigurableCacheFactory.destroyCache()
  Except for the case where the application code expicitly allocated the cache, this method should not be called by application code.
  Specified by:
    `destroy` in interface `NamedCache`
  See Also:
    `CacheFactory.destroyCache(NamedCache)`, `ConfigurableCacheFactory.destroyCache(NamedCache)`

### lock

    public boolean lock(java.lang.Object oKey,
                        long cWait)

  Attempt to lock the specified item within the specified period of time.

  The item doesn't have to exist to be locked. While the item is locked there is known to be a lock holder which has an exclusive right to modify (calling put and remove methods) that item.

  Lock holder is an abstract concept that depends on the ConcurrentMap implementation. For example, holder could be a 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.

  Specified by:
    `lock` in interface `ConcurrentMap`
  Parameters:
    `oKey` - key being locked
    `cWait` - 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 obtained
  Returns:
    true if the item was successfully locked within the specified time; false otherwise

### lock

    public boolean lock(java.lang.Object oKey)

  Attempt to lock the specified item and return immediately.

  This method behaves exactly as if it simply performs the call `lock(oKey, 0)`.

  Specified by:
    `lock` in interface `ConcurrentMap`
  Parameters:
    `oKey` - key being locked
  Returns:
    true if the item was successfully locked; false otherwise

### unlock

    public boolean unlock(java.lang.Object oKey)

  Unlock the specified item. The item doesn't have to exist to be unlocked. If the item is currently locked, only the holder of the lock could successfully unlock it.
  Specified by:
    `unlock` in interface `ConcurrentMap`
  Parameters:
    `oKey` - key being unlocked
  Returns:
    true if the item was successfully unlocked; false otherwise

### invoke

    public 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.
  Specified by:
    `invoke` in interface `InvocableMap`
  Parameters:
    `oKey` - the key to process; it is not required to exist within the Map
    `agent` - the EntryProcessor to use to process the specified key
  Returns:
    the result of the invocation as returned from the EntryProcessor

### invokeAll

    public 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.
  Specified by:
    `invokeAll` in interface `InvocableMap`
  Parameters:
    `collKeys` - the keys to process; these keys are not required to exist within the Map
    `agent` - the EntryProcessor to use to process the specified keys
  Returns:
    a Map containing the results of invoking the EntryProcessor against each of the specified keys

### invokeAll

    public 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. 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`.
  Specified by:
    `invokeAll` in interface `InvocableMap`
  Parameters:
    `filter` - a Filter that results in the set of keys to be processed
    `agent` - the EntryProcessor to use to process the specified keys
  Returns:
    a Map containing the results of invoking the EntryProcessor against the keys that are selected by the given Filter

### aggregate

    public java.lang.Object aggregate(java.util.Collection collKeys,
                                      InvocableMap.EntryAggregator agent)

  Perform an aggregating operation against the entries specified by the passed keys.
  Specified by:
    `aggregate` in interface `InvocableMap`
  Parameters:
    `collKeys` - the Collection of keys that specify the entries within this Map to aggregate across
    `agent` - the EntryAggregator that is used to aggregate across the specified entries of this Map
  Returns:
    the result of the aggregation

### aggregate

    public 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.
  Specified by:
    `aggregate` in interface `InvocableMap`
  Parameters:
    `filter` - the Filter that is used to select entries within this Map to aggregate across
    `agent` - the EntryAggregator that is used to aggregate across the selected entries of this Map
  Returns:
    the result of the aggregation

### keySet

    public 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. 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.
  Specified by:
    `keySet` in interface `QueryMap`
  Parameters:
    `filter` - the Filter object representing the criteria that the entries of this map should satisfy
  Returns:
    a set of keys for entries that satisfy the specified criteria

### entrySet

    public 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. Each element in the returned set is a `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.
  Specified by:
    `entrySet` in interface `QueryMap`
  Parameters:
    `filter` - the Filter object representing the criteria that the entries of this map should satisfy
  Returns:
    a set of entries that satisfy the specified criteria

### entrySet

    public 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. Each element in the returned set is a `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.
  Specified by:
    `entrySet` in interface `QueryMap`
  Parameters:
    `filter` - the Filter object representing the criteria that the entries of this map should satisfy
    `comparator` - the Comparator object which imposes an ordering on entries in the resulting set; or `null` if the entries' values natural ordering should be used
  Returns:
    a set of entries that satisfy the specified criteria
  See Also:
    `ChainedComparator`

### addIndex

    public void addIndex(ValueExtractor extractor,
                         boolean fOrdered,
                         java.util.Comparator comparator)

  Add an index to this QueryMap. This allows to correlate values stored in this indexed Map (or attributes of those values) to the corresponding keys in the indexed Map and increase the performance of `keySet` and `entrySet` methods. 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.
  Specified by:
    `addIndex` in interface `QueryMap`
  Parameters:
    `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 otherwise
    `comparator` - the Comparator object which imposes an ordering on entries in the indexed map; or `null` if the entries' values natural ordering should be used
  See Also:
    `ReflectionExtractor`, `ChainedComparator`

### removeIndex

    public void removeIndex(ValueExtractor extractor)

  Remove an index from this QueryMap.
  Specified by:
    `removeIndex` in interface `QueryMap`
  Parameters:
    `extractor` - the ValueExtractor object that is used to extract an indexable Object from a value stored in the Map.

### getNamedCache

    public NamedCache getNamedCache()

  Return the underlying NamedCache.
  Returns:
    the underlying NamedCache

Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.