public abstract class InvocableMapHelper extends Base
Modifier and Type | Class and Description |
---|---|
protected static class |
InvocableMapHelper.IndexAdapter
MapListener implementation that routes the map events into the
corresponding MapIndex calls.
|
protected static class |
InvocableMapHelper.RoutingBinaryEntry
BinaryEntry wrapper that routes the getValue()/getBinaryValue()
calls onto getOriginalValue()/getOriginalBinaryValue().
|
protected static class |
InvocableMapHelper.RoutingMapTriggerEntry
MapTrigger.Entry wrapper that routes the getValue() call onto
getOriginalValue().
|
static class |
InvocableMapHelper.SimpleEntry<K,V>
Simple implementation of the InvocableMap.Entry interface.
|
Base.LoggingWriter, Base.StackFrame
Modifier and Type | Field and Description |
---|---|
static Converter |
ENTRY_TO_KEY_CONVERTER
Trivial Entry-to-Key converter.
|
static Converter |
ENTRY_TO_VALUE_CONVERTER
Trivial Entry-to-Value converter.
|
Constructor and Description |
---|
InvocableMapHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
addIndex(ValueExtractor extractor,
boolean fOrdered,
Comparator comparator,
ObservableMap map,
Map mapIndex)
Add an index to the given map of indexes, keyed by the given extractor.
|
static <K,V> Set<InvocableMap.Entry<K,V>> |
duplicateEntrySet(Map<K,V> map,
Collection<? extends Map.Entry<K,V>> collEntries,
boolean fReadOnly)
Create a set of
InvocableMap.Entry objects using the specified
collection of Map.Entry objects. |
protected static MapListener |
ensureListener(MapIndex index)
Ensure a MapListener for the given index.
|
static <K,V> boolean |
evaluateEntry(Filter filter,
K oKey,
V oValue)
Check if an entry, expressed as a key and value, passes the filter
evaluation.
|
static <K,V> boolean |
evaluateEntry(Filter filter,
Map.Entry<K,V> entry)
Check if the entry passes the filter evaluation.
|
static boolean |
evaluateOriginalEntry(Filter filter,
MapTrigger.Entry entry)
Check if the entry, in its "original" form, passes the filter evaluation.
|
static <T,E,K,V> E |
extractFromEntry(ValueExtractor<? super T,? extends E> extractor,
Map.Entry<? extends K,? extends V> entry)
Extract a value from the specified entry using the specified extractor.
|
static Object |
extractOriginalFromEntry(ValueExtractor extractor,
MapTrigger.Entry entry)
Extract a value from the "original value" of the specified entry using
the specified extractor.
|
static <K,V,R> CompletableFuture<Map<K,R>> |
invokeAllAsync(NamedCache<K,V> cache,
Collection<? extends K> setKey,
int nOrderId,
InvocableMap.EntryProcessor<K,V,R> proc,
BiConsumer<? super Map<? extends K,? extends R>,? super Throwable>... continuations)
Invoke the specified EntryProcessor asynchronously.
|
static <K,V,R> CompletableFuture<Map<K,R>> |
invokeAllAsync(NamedCache<K,V> cache,
Collection<? extends K> setKey,
ToIntFunction<K> funcOrder,
InvocableMap.EntryProcessor<K,V,R> proc,
BiConsumer<? super Map<? extends K,? extends R>,? super Throwable>... continuations)
Invoke the specified EntryProcessor asynchronously.
|
static <K,V,R> Map<K,R> |
invokeAllLocked(ConcurrentMap<K,V> map,
Set<? extends InvocableMap.Entry<K,V>> setEntries,
InvocableMap.EntryProcessor<K,V,R> agent)
Invoke the passed EntryProcessor against the entries specified by the
passed map and entries.
|
static <K,V,R> CompletableFuture<R> |
invokeAsync(NamedCache<K,V> cache,
K key,
int nOrderId,
InvocableMap.EntryProcessor<K,V,R> proc,
BiConsumer<? super R,? super Throwable>... continuations)
Invoke the specified EntryProcessor asynchronously.
|
static <K,V,R> CompletableFuture<R> |
invokeAsync(NamedCache<K,V> cache,
K key,
InvocableMap.EntryProcessor<K,V,R> proc)
Deprecated.
As of Coherence 14.1.1, use enhanced
#invokeAsync(NamedCache, Object, int, EntryProcessor, BiConsumer[]) . |
static <K,V,R> R |
invokeLocked(ConcurrentMap<K,V> map,
InvocableMap.Entry<K,V> entry,
InvocableMap.EntryProcessor<K,V,R> agent)
Invoke the passed EntryProcessor against the specified Entry.
|
static List |
lockAll(ConcurrentMap map,
Collection collKeys,
long cWait)
Attempt to lock all the specified keys within a specified period of time.
|
static <K,V> InvocableMapHelper.SimpleEntry<K,V> |
makeEntry(Map<K,V> map,
K key)
Create a SimpleEntry object for the specified map and the key.
|
static <K,V> Set<InvocableMap.Entry<K,V>> |
makeEntrySet(Collection<? extends Map.Entry<K,V>> collEntries)
Create a set of read-only SimpleEntry objects for the specified collection
of Map.Entry objects.
|
static <K,V> Set<InvocableMap.Entry<K,V>> |
makeEntrySet(Map<K,V> map,
Collection<? extends K> collKeys,
boolean fReadOnly)
Create a set of SimpleEntry objects for the specified map and
the key collection.
|
static Set |
query(Map map,
Filter filter,
boolean fEntries,
boolean fSort,
Comparator comparator)
Generic implementation of the
QueryMap API. |
static Set |
query(Map map,
Map mapIndexes,
Filter filter,
boolean fEntries,
boolean fSort,
Comparator comparator)
Generic implementation of the
QueryMap API. |
static void |
removeIndex(ValueExtractor extractor,
ObservableMap map,
Map mapIndex)
Remove the index keyed by the given extractor from the given map of
indexes.
|
static void |
unlockAll(ConcurrentMap map,
Collection collKeys)
Unlock all the specified keys.
|
static <K,V,U> void |
updateEntry(ValueUpdater<V,U> updater,
Map.Entry<K,V> entry,
U oValue)
Update the specified entry using the specified updater and value.
|
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
public static final Converter ENTRY_TO_KEY_CONVERTER
public static final Converter ENTRY_TO_VALUE_CONVERTER
public static <K,V,R> CompletableFuture<R> invokeAsync(NamedCache<K,V> cache, K key, InvocableMap.EntryProcessor<K,V,R> proc)
#invokeAsync(NamedCache, Object, int, EntryProcessor, BiConsumer[])
.K
- the key typeV
- the value typeR
- the result typecache
- the cache to invoke againstkey
- the key to invoke uponproc
- the processor to invoke@SafeVarargs public static <K,V,R> CompletableFuture<R> invokeAsync(NamedCache<K,V> cache, K key, int nOrderId, InvocableMap.EntryProcessor<K,V,R> proc, BiConsumer<? super R,? super Throwable>... continuations)
The continuation which will be invoked when the processor completes and most importantly on the thread on which the operation completes which is not something that can be guaranteed if the continuation is applied via the returned CompletableFuture.
K
- the key typeV
- the value typeR
- the result typecache
- the cache to invoke againstkey
- the key to invoke uponnOrderId
- the unit of orderproc
- the processor to invokecontinuations
- continuations which will be invoked when the operation completes@SafeVarargs public static <K,V,R> CompletableFuture<Map<K,R>> invokeAllAsync(NamedCache<K,V> cache, Collection<? extends K> setKey, int nOrderId, InvocableMap.EntryProcessor<K,V,R> proc, BiConsumer<? super Map<? extends K,? extends R>,? super Throwable>... continuations)
The continuation which will be invoked when the processor completes and most importantly on the thread on which the operation completes which is not something that can be guaranteed if the continuation is applied via the returned CompletableFuture.
K
- the key typeV
- the value typeR
- the result typecache
- the cache to invoke againstsetKey
- the set of keys to invoke uponnOrderId
- the unit of orderproc
- the processor to invokecontinuations
- continuations which will be invoked when the operation completes@SafeVarargs public static <K,V,R> CompletableFuture<Map<K,R>> invokeAllAsync(NamedCache<K,V> cache, Collection<? extends K> setKey, ToIntFunction<K> funcOrder, InvocableMap.EntryProcessor<K,V,R> proc, BiConsumer<? super Map<? extends K,? extends R>,? super Throwable>... continuations)
The continuation which will be invoked when the processor completes and most importantly on the thread on which the operation completes which is not something that can be guaranteed if the continuation is applied via the returned CompletableFuture.
K
- the key typeV
- the value typeR
- the result typecache
- the cache to invoke againstsetKey
- the set of keys to invoke uponfuncOrder
- function to compute unit of order based on th ekeyproc
- the processor to invokecontinuations
- continuations which will be invoked when the operation completespublic static <K,V,R> R invokeLocked(ConcurrentMap<K,V> map, InvocableMap.Entry<K,V> entry, InvocableMap.EntryProcessor<K,V,R> agent)
map
- the ConcurrentMap that the EntryProcessor works againstentry
- the InvocableMap.Entry to process; it is not required to
exist within the Mapagent
- the EntryProcessor to use to process the specified keypublic static <K,V,R> Map<K,R> invokeAllLocked(ConcurrentMap<K,V> map, Set<? extends InvocableMap.Entry<K,V>> setEntries, InvocableMap.EntryProcessor<K,V,R> agent)
map
- the ConcurrentMap that the EntryProcessor works againstsetEntries
- a set of InvocableMap.Entry objects to processagent
- the EntryProcessor to use to process the specified keyspublic static List lockAll(ConcurrentMap map, Collection collKeys, long cWait)
map
- the ConcurrentMap to usecollKeys
- a collection of keys to lockcWait
- the number of milliseconds to continue trying to obtain
locks; pass zero to return immediately; pass -1 to block
the calling thread until the lock could be obtainedpublic static void unlockAll(ConcurrentMap map, Collection collKeys)
map
- the ConcurrentMap to usecollKeys
- a collection of keys to unlockpublic static <K,V> InvocableMapHelper.SimpleEntry<K,V> makeEntry(Map<K,V> map, K key)
map
- the ConcurrentMap to create entries forkey
- the key to create an entry for; the key is not
required to exist within the Mappublic static <K,V> Set<InvocableMap.Entry<K,V>> makeEntrySet(Map<K,V> map, Collection<? extends K> collKeys, boolean fReadOnly)
map
- the Map to create entries forcollKeys
- collection of keys to create entries for; these keys
are not required to exist within the MapfReadOnly
- if true, the returned entries will be marked as
read-onlypublic static <K,V> Set<InvocableMap.Entry<K,V>> makeEntrySet(Collection<? extends Map.Entry<K,V>> collEntries)
collEntries
- collection of Map.Entry objects to create SimpleEntry
objects forpublic static <K,V> Set<InvocableMap.Entry<K,V>> duplicateEntrySet(Map<K,V> map, Collection<? extends Map.Entry<K,V>> collEntries, boolean fReadOnly)
InvocableMap.Entry
objects using the specified
collection of Map.Entry objects.map
- the parent Map for the entriescollEntries
- collection of Map.Entry objects to copy fromfReadOnly
- if true, the returned entries will be marked as
read-onlypublic static <K,V> boolean evaluateEntry(Filter filter, Map.Entry<K,V> entry)
filter
- the filter to evaluate againstentry
- a key value pair to filterpublic static <K,V> boolean evaluateEntry(Filter filter, K oKey, V oValue)
filter
- the filter to evaluate againstoKey
- the key for the entryoValue
- the value for the entrypublic static boolean evaluateOriginalEntry(Filter filter, MapTrigger.Entry entry)
filter
- the filter to evaluate againstentry
- the entry whose "original" value to evaluatepublic static <T,E,K,V> E extractFromEntry(ValueExtractor<? super T,? extends E> extractor, Map.Entry<? extends K,? extends V> entry)
T
- the type of the value to extract fromE
- the type of value that will be extractedK
- the entry key typeV
- the entry value typeextractor
- the extractor to useentry
- the entry to extract frompublic static Object extractOriginalFromEntry(ValueExtractor extractor, MapTrigger.Entry entry)
extractor
- the extractor to useentry
- the entry to extract frompublic static <K,V,U> void updateEntry(ValueUpdater<V,U> updater, Map.Entry<K,V> entry, U oValue)
updater
- the updater to useentry
- the entry to updateoValue
- the new valuepublic static Set query(Map map, Filter filter, boolean fEntries, boolean fSort, Comparator comparator)
QueryMap
API.map
- the underlying Mapfilter
- the FilterfEntries
- if true, return an entry-set; otherwise a key-setfSort
- if true, sort the entry-set before returningcomparator
- the Comparator to use for sorting (optional)public static Set query(Map map, Map mapIndexes, Filter filter, boolean fEntries, boolean fSort, Comparator comparator)
QueryMap
API.map
- the underlying MapmapIndexes
- the map of available MapIndex
objects keyed by
the related ValueExtractor; read-onlyfilter
- the FilterfEntries
- if true, return an entry-set; otherwise a key-setfSort
- if true, sort the entry-set before returningcomparator
- the Comparator to use for sorting (optional)public static void addIndex(ValueExtractor extractor, boolean fOrdered, Comparator comparator, ObservableMap map, Map mapIndex)
extractor
- the ValueExtractor object that is used to extract an
indexable property value from a resource map entryfOrdered
- true if 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
usedmap
- the resource map that the newly created MapIndex
will use for initialization and listen to for changesmapIndex
- the map of indexes that the newly created MapIndex
will be added topublic static void removeIndex(ValueExtractor extractor, ObservableMap map, Map mapIndex)
extractor
- the ValueExtractor object that is used to extract an
indexable Object from a value stored in the Map.map
- the resource map to remove the index formapIndex
- the map of indexes to remove the MapIndex fromprotected static MapListener ensureListener(MapIndex index)
index
- the index