Class ObservableSplittingBackingMap
- All Implemented Interfaces:
Disposable
,CacheMap
,PartitionAwareBackingMap
,ObservableMap
,AutoCloseable
,Map
- Direct Known Subclasses:
ObservableSplittingBackingCache
- Since:
- Coherence 3.5
- Author:
- cp 2009-01-09
-
Nested Class Summary
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 class com.tangosol.util.AbstractKeyBasedMap
AbstractKeyBasedMap.DeferredCacheEvent<K,
V> Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
Field Summary
Fields inherited from class com.tangosol.util.WrapperObservableMap
m_fDeferredEvent, m_fTranslateEvents, m_listenerInternal, m_listenerSupport, m_map, m_stats
Fields inherited from class com.tangosol.util.Base
LOG_ALWAYS, LOG_CONFIG, LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_MAX, LOG_MIN, LOG_QUIET, LOG_WARN, POWER_0, POWER_G, POWER_K, POWER_M, POWER_T, UNIT_D, UNIT_H, UNIT_M, UNIT_MS, UNIT_NS, UNIT_S, UNIT_US
Fields inherited from interface com.tangosol.net.cache.CacheMap
EXPIRY_DEFAULT, EXPIRY_NEVER
-
Constructor Summary
ConstructorDescriptionObservableSplittingBackingMap
(BackingMapManager bmm, String sName) Create a ObservableSplittingBackingMap that will delegate each partition's data and operations to a separate backing map.Create a ObservableSplittingBackingMap that will delegate each partition's data and operations to a separate backing map. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMapListener
(MapListener listener, Filter filter, boolean fLite) Add a map listener that receives events based on a filter evaluation.void
addMapListener
(MapListener listener, Object oKey, boolean fLite) Add a map listener for a specific 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.Obtain the BackingMapManager that this PartitionAwareBackingMap uses to instantiate and release backing maps.Return the CacheStatistics for this cache.getName()
Determine the name of the cache for which this PartitionAwareBackingMap exists.getPartitionMap
(int nPid) Obtain a Map view for the data in a specific partition.getPartitionMap
(PartitionSet partitions) Obtain a Map view for the data in a specific set of partitions.Obtain the underlying PartitionSplittingBackingMap.protected Set
Factory pattern: Create a Set that represents the keys in the Mapboolean
Check whether or not statistics are collected by the wrapper.protected boolean
Determine if this ObservableMap has to fabricate events itself.protected void
prepareUpdate
(Map mapPart, Map mapUpdate) Prepare mapPart, a map representing a partition, for the impending changes in which all of the mappings from mapUpdate will be copied to mapPart.Associates the specified value with the specified key in this cache.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, Object oKey) Remove a map listener that previously signed up for events about a specific key.void
setTranslateEvents
(boolean fTranslate) Specify whether or not an event source has to be translated by the wrapper.toString()
Return a human-readable description for this ObservableSplittingBackingMap.Methods inherited from class com.tangosol.util.WrapperObservableMap
addMapListener, clear, containsValue, dispatchEvent, dispatchPendingEvent, ensureInternalListener, ensureMapListenerSupport, equals, get, getDescription, getInternalKeySet, getMap, getMapListenerSupport, hashCode, hasListeners, instantiateInternalListener, isInternalKeySetIteratorMutable, isSynthetic, isTranslateEvents, put, putAll, remove, removeBlind, removeMapListener, setCollectStats
Methods inherited from class com.tangosol.util.AbstractKeySetBasedMap
containsKey, instantiateEntrySet, instantiateKeyIterator, instantiateValues, isEmpty, iterateKeys, size
Methods inherited from class com.tangosol.util.AbstractKeyBasedMap
clone, entrySet, getAll, keySet, values
Methods inherited from class com.tangosol.util.Base
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, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, 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
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.oracle.coherence.common.base.Disposable
close
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
Methods inherited from interface com.tangosol.util.ObservableMap
addMapListener, removeMapListener
-
Constructor Details
-
ObservableSplittingBackingMap
Create a ObservableSplittingBackingMap that will delegate each partition's data and operations to a separate backing map.- Parameters:
bmm
- a callback that knows how to create and release the backing maps that this PartitionSplittingBackingMap is responsible forsName
- the cache name for which this backing map exists
-
ObservableSplittingBackingMap
Create a ObservableSplittingBackingMap that will delegate each partition's data and operations to a separate backing map.- Parameters:
map
- the PartitionAwareBackingMap to delegate to
-
-
Method Details
-
put
Associates the specified value with the specified key in this cache. If the cache previously contained a mapping for this key, the old value is replaced. This variation of theCacheMap.put(Object oKey, Object oValue)
method allows the caller to specify an expiry (or "time to live") for the cache entry.- Specified by:
put
in interfaceCacheMap
- Parameters:
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"; passCacheMap.EXPIRY_DEFAULT
to use the cache's default time-to-live setting; passCacheMap.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()- Returns:
- previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key, if the implementation supports null values
-
addMapListener
Add a map listener for a specific key.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.- Specified by:
addMapListener
in interfaceObservableMap
- Overrides:
addMapListener
in classWrapperObservableMap
- Parameters:
listener
- theMapEvent
listener to addoKey
- the key that identifies the entry for which to raise eventsfLite
- true to indicate that theMapEvent
objects do not have to include the OldValue and NewValue property values in order to allow optimizations
-
removeMapListener
Remove a map listener that previously signed up for events about a specific key.- Specified by:
removeMapListener
in interfaceObservableMap
- Overrides:
removeMapListener
in classWrapperObservableMap
- Parameters:
listener
- the listener to removeoKey
- the key that identifies the entry for which to raise events
-
addMapListener
Add a map listener that receives events based on a filter evaluation.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.- Specified by:
addMapListener
in interfaceObservableMap
- Overrides:
addMapListener
in classWrapperObservableMap
- Parameters:
listener
- theMapEvent
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 (seeMapEventFilter
); null is equivalent to a filter that alway returns truefLite
- true to indicate that theMapEvent
objects do not have to include the OldValue and NewValue property values in order to allow optimizations
-
removeMapListener
Remove a map listener that previously signed up for events based on a filter evaluation.- Specified by:
removeMapListener
in interfaceObservableMap
- Overrides:
removeMapListener
in classWrapperObservableMap
- Parameters:
listener
- the listener to removefilter
- the filter that was passed into the corresponding addMapListener() call
-
getBackingMapManager
Obtain the BackingMapManager that this PartitionAwareBackingMap uses to instantiate and release backing maps.- Specified by:
getBackingMapManager
in interfacePartitionAwareBackingMap
- Returns:
- the BackingMapManager
-
getName
Determine the name of the cache for which this PartitionAwareBackingMap exists.- Specified by:
getName
in interfacePartitionAwareBackingMap
- Returns:
- the cache name
-
createPartition
public void createPartition(int nPid) Add a partition to the PartitionAwareBackingMap.- Specified by:
createPartition
in interfacePartitionAwareBackingMap
- Parameters:
nPid
- the partition id that the PartitionAwareBackingMap will be responsible for, starting at this instant
-
destroyPartition
public void destroyPartition(int nPid) Remove a partition from the PartitionAwareBackingMap.- Specified by:
destroyPartition
in interfacePartitionAwareBackingMap
- Parameters:
nPid
- the partition id that the PartitionAwareBackingMap will no longer be responsible for, starting at this instant
-
instantiateKeySet
Factory pattern: Create a Set that represents the keys in the Map- Overrides:
instantiateKeySet
in classAbstractKeySetBasedMap
- Returns:
- a new instance of Set that represents the keys in the Map
-
getPartitionMap
Obtain a Map view for the data in a specific partition.- Specified by:
getPartitionMap
in interfacePartitionAwareBackingMap
- Parameters:
nPid
- the partition ID- Returns:
- the backing map (or null if that partition is not owned)
-
getPartitionMap
Obtain a Map view for the data in a specific set of partitions.- Specified by:
getPartitionMap
in interfacePartitionAwareBackingMap
- Parameters:
partitions
- the masking PartitionSet- Returns:
- a read-only view into a subset of backing maps
-
dispose
public void dispose()Invoked when all resources owned by the implementer can safely be released.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.
- Specified by:
dispose
in interfaceDisposable
-
getPartitionSplittingBackingMap
Obtain the underlying PartitionSplittingBackingMap.- Returns:
- the underlying PartitionSplittingBackingMap
-
isEventFabricator
protected boolean isEventFabricator()Determine if this ObservableMap has to fabricate events itself.- Overrides:
isEventFabricator
in classWrapperObservableMap
- Returns:
- true if events are expected, but the wrapped Map does not generate any events itself
-
setTranslateEvents
public void setTranslateEvents(boolean fTranslate) Specify whether or not an event source has to be translated by the wrapper.Note: this setting is only meaningful if the underlying map is an ObservableMap itself.
- Overrides:
setTranslateEvents
in classWrapperObservableMap
- Parameters:
fTranslate
- true if this wrapper should translate an event source; false otherwise
-
getCacheStatistics
Return the CacheStatistics for this cache.- Overrides:
getCacheStatistics
in classWrapperObservableMap
- Returns:
- a CacheStatistics object
-
isCollectStats
public boolean isCollectStats()Check whether or not statistics are collected by the wrapper.- Overrides:
isCollectStats
in classWrapperObservableMap
- Returns:
- true if this wrapper collects cache statistics; false otherwise
-
toString
Return a human-readable description for this ObservableSplittingBackingMap.- Overrides:
toString
in classWrapperObservableMap
- Returns:
- a String description of the ObservableSplittingBackingMap
-
prepareUpdate
Prepare mapPart, a map representing a partition, for the impending changes in which all of the mappings from mapUpdate will be copied to mapPart.- Parameters:
mapPart
- the map to be mutated with the contents of mapUpdatemapUpdate
- the map of changes to be applied
-