public class PartitionSplittingBackingMap extends AbstractKeyBasedMap implements Disposable, PartitionAwareBackingMap
Also, as with all usage of BinaryMap, if the data are stored off-heap, the proper use of the MaxDirectMemorySize JVM switch will be crucial.
| Modifier and Type | Class and Description |
|---|---|
class |
PartitionSplittingBackingMap.AggregatingCacheStatistics
An implementation of the CacheStatics interface that aggregates across the CacheStatics objects provided by each of the backing maps corresponding to the partitions managed by this PartitionSplittingBackingMap.
|
protected class |
PartitionSplittingBackingMap.KeySet
A KeySet implementation optimized for PartitionSplittingBackingMap.
|
static class |
PartitionSplittingBackingMap.MapArray
The MapArray is a data structure that provides a mapping between partition IDs and backing maps.
|
class |
PartitionSplittingBackingMap.MaskedPartitionMap
A read-only view into a subset of backing maps managed by the underlying PartitionSplittingBackingMap.
|
class |
PartitionSplittingBackingMap.PartitionedIterator
An Iterator designed to ensure that a stable copy of each partition's keys is available for the duration of the iteration over its keys.
|
AbstractKeyBasedMap.DeferredCacheEvent<K,V>, AbstractKeyBasedMap.EntrySet, AbstractKeyBasedMap.ValuesCollectionBase.LoggingWriter, Base.StackFrame| Constructor and Description |
|---|
PartitionSplittingBackingMap(BackingMapManager bmm, String sName)
Create a PartitionSplittingBackingMap that will delegate each partition's data and operations to a separate backing map.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear all key/value mappings.
|
boolean |
containsKey(Object oKey)
Returns true if this map contains a mapping for the specified key.
|
void |
createPartition(int nPid)
Add a partition to the PartitionAwareBackingMap.
|
void |
destroyPartition(int nPid)
Remove a partition from the PartitionAwareBackingMap.
|
void |
dispose()
Invoked when all resources owned by the implementer can safely be released.
|
Object |
get(Object oKey)
Returns the value to which this map maps the specified key.
|
protected Map |
getBackingMap(Object oKey)
Obtain a backing map for the specified key.
|
BackingMapManager |
getBackingMapManager()
Obtain the BackingMapManager that this PartitionAwareBackingMap uses to instantiate and release backing maps.
|
CacheStatistics |
getCacheStatistics()
Returns the CacheStatistics for this cache.
|
protected BackingMapManagerContext |
getContext()
Obtain the BackingMapManagerContext that provides the partition information for keys that are stored in the backing map.
|
protected PartitionSplittingBackingMap.MapArray |
getMapArray()
Get the mapping between partition IDs and backing maps.
|
String |
getName()
Determine the name of the cache for which this PartitionAwareBackingMap exists.
|
Map |
getPartitionMap(int nPid)
Obtain a Map view for the data in a specific partition.
|
Map |
getPartitionMap(PartitionSet partitions)
Obtain a Map view for the data in a specific set of partitions.
|
protected Set |
instantiateKeySet()
Factory pattern: Create a Set that represents the keys in the Map
|
boolean |
isEmpty()
Returns true if this map contains no key-value mappings.
|
protected boolean |
isEmpty(Map[] amap)
Return true iff a subset of the maps that belong to specified partitions contains no entries.
|
boolean |
isStrict()
Determine if any access to data in missing partitions is being treated as an error.
|
protected Iterator |
iterateKeys()
Create an iterator over the keys in this Map.
|
protected Iterator |
iterateKeys(Map[] amap)
Create an iterator over the keys in maps that belong to partitions contained in the specified PartitionSet.
|
protected String |
makeName(String sName, int nPid)
Format a synthetic name for a partition-specific backing map.
|
Object |
put(Object oKey, Object oValue)
Associates the specified value with the specified key in this map.
|
void |
putAll(Map map)
Copies all of the mappings from the specified map to this map.
|
protected void |
putAllInternal(Map mapPart, Map mapUpdate)
Put all entries in mapUpdate into the provided map.
|
protected Object |
putInternal(Map mapPart, Object oKey, Object oValue)
Put the key and value into a map representing a given partition.
|
Object |
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.
|
protected void |
reportMissingPartition(Object oKey, int nPid)
Report a missing partition according to the "strict" flag rules.
|
void |
setStrict(boolean fStrict)
Specify whether any access to data in missing partitions should be treated as an error.
|
int |
size()
Returns the number of key-value mappings in this map.
|
protected int |
size(Map[] amap)
Return the number of key-value mappings in a subset of the maps that belong to specified partitions.
|
String |
toString()
Return a human-readable description for this PartitionBackingMap.
|
String |
toString(boolean fVerbose)
Return a human-readable description for this PartitionBackingMap.
|
clone, containsValue, entrySet, equals, getAll, hashCode, instantiateEntrySet, instantiateValues, keySet, valuesazzert, 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, 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, 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, waitfinalize, getClass, notify, notifyAll, wait, wait, waitclosecompute, computeIfAbsent, computeIfPresent, containsValue, entrySet, equals, forEach, getOrDefault, hashCode, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, valuespublic PartitionSplittingBackingMap(BackingMapManager bmm, String sName)
bmm - a BackingMapManager that knows how to create and release the backing maps that this PartitionSplittingBackingMap is responsible forsName - the cache name for which this backing map existspublic void clear()
clear in interface Mapclear in class AbstractKeyBasedMappublic boolean containsKey(Object oKey)
containsKey in interface MapcontainsKey in class AbstractKeyBasedMappublic Object get(Object oKey)
get in interface Mapget in class AbstractKeyBasedMapoKey - the key objectpublic boolean isEmpty()
isEmpty in interface MapisEmpty in class AbstractKeyBasedMappublic Object put(Object oKey, Object oValue)
put in interface Mapput in class AbstractKeyBasedMapoKey - key with which the specified value is to be associatedoValue - value to be associated with the specified keypublic void putAll(Map map)
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.putAll in interface MapputAll in class AbstractKeyBasedMapmap - the Map containing the key/value pairings to put into this Mappublic Object remove(Object oKey)
remove in interface Mapremove in class AbstractKeyBasedMapoKey - key whose mapping is to be removed from the mapprotected boolean removeBlind(Object oKey)
removeBlind in class AbstractKeyBasedMapoKey - key whose mapping is to be removed from the mappublic int size()
size in interface Mapsize in class AbstractKeyBasedMapprotected Iterator iterateKeys()
iterateKeys in class AbstractKeyBasedMapprotected Set instantiateKeySet()
instantiateKeySet in class AbstractKeyBasedMappublic CacheStatistics getCacheStatistics()
public BackingMapManager getBackingMapManager()
getBackingMapManager in interface PartitionAwareBackingMappublic String getName()
getName in interface PartitionAwareBackingMappublic void createPartition(int nPid)
createPartition in interface PartitionAwareBackingMapnPid - the partition id that the PartitionAwareBackingMap will be responsible for, starting at this instantpublic void destroyPartition(int nPid)
destroyPartition in interface PartitionAwareBackingMapnPid - the partition id that the PartitionAwareBackingMap will no longer be responsible for, starting at this instantpublic Map getPartitionMap(int nPid)
getPartitionMap in interface PartitionAwareBackingMapnPid - the partition IDpublic Map getPartitionMap(PartitionSet partitions)
getPartitionMap in interface PartitionAwareBackingMappartitions - the masking PartitionSetpublic void dispose()
Once disposed of the object should no longer be considered to be usable.
Note the Disposable interface is compatible with try-with-resources which will automatically invoke this method.
dispose in interface Disposablepublic boolean isStrict()
public void setStrict(boolean fStrict)
fStrict - if true, any access to missing partitions should being treated as errorprotected Object putInternal(Map mapPart, Object oKey, Object oValue)
mapPart - a partition mapoKey - oKey with which the specified value is to be associatedoValue - oValue to be associated with the specified oKeyprotected void putAllInternal(Map mapPart, Map mapUpdate)
mapPart - a partition mapmapUpdate - the Map containing the key/value pairings to put into mapPartprotected BackingMapManagerContext getContext()
protected int size(Map[] amap)
amap - the array of maps to processprotected boolean isEmpty(Map[] amap)
amap - the array of maps to processprotected Iterator iterateKeys(Map[] amap)
amap - the array of maps to processprotected PartitionSplittingBackingMap.MapArray getMapArray()
protected Map getBackingMap(Object oKey)
oKey - the keyprotected String makeName(String sName, int nPid)
sName - the name of the cachenPid - the partition numberpublic String toString()
toString in class AbstractKeyBasedMappublic String toString(boolean fVerbose)
fVerbose - if true, generate a verbose descritionprotected void reportMissingPartition(Object oKey, int nPid)
oKey - the key for which an operation failed (optional)nPid - the missing partition; meaningful only if oKey is null