Package com.tangosol.net.cache
Class CacheStoreMap.ReadWriteMap
- java.lang.Object
-
- com.tangosol.util.Base
-
- com.tangosol.util.AbstractKeyBasedMap
-
- com.tangosol.net.cache.CacheStoreMap.ReadWriteMap
-
- All Implemented Interfaces:
Map
- Enclosing class:
- CacheStoreMap
public static class CacheStoreMap.ReadWriteMap extends AbstractKeyBasedMap
A Map implementation that delegates straight through to a CacheStore.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.util.AbstractKeyBasedMap
AbstractKeyBasedMap.DeferredCacheEvent<K,V>, AbstractKeyBasedMap.EntrySet, AbstractKeyBasedMap.KeySet, AbstractKeyBasedMap.ValuesCollection
-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_fBlindTrue means that put() and remove() can return null, regardless of the presence of an old value.protected booleanm_fEraseUnsupportedTrue means that a call to the CacheStore erase() method is assumed to be unsupported.protected booleanm_fStoreUnsupportedTrue means that a call to the CacheStore store() method is assumed to be unsupported.protected CacheStorem_storeThe CacheStore to delegate all Map operations to.
-
Constructor Summary
Constructors Constructor Description ReadWriteMap(CacheStore store, boolean fBlind)Construct a read/write CacheStoreMap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear is explicitly not implemented.booleancontainsKey(Object oKey)Returns true if this map contains a mapping for the specified key.Objectget(Object oKey)Returns the value to which this map maps the specified key.MapgetAll(Collection colKeys)Get all the specified keys, if they are in the Map.protected booleanisBlindPutAllowed()Determine if the "blind put" optimization is possible.protected booleanisBlindRemoveAllowed()Determine if the "blind remove" optimization is possible.protected booleanisEraseUnsupported()Determine if the CacheStore has been determined to be read-only for erase() operations.protected booleanisStoreUnsupported()Determine if the CacheStore has been determined to be read-only for store() operations.protected IteratoriterateKeys()Create an iterator over the keys in this Map.Objectput(Object oKey, Object oValue)Associates the specified value with the specified key in this map.voidputAll(Map map)Copies all of the mappings from the specified map to this map.Objectremove(Object oKey)Removes the mapping for this key from this map if present.protected booleanremoveBlind(Object oKey)Removes the mapping for this key from this map if present.-
Methods inherited from class com.tangosol.util.AbstractKeyBasedMap
clone, containsValue, entrySet, equals, hashCode, instantiateEntrySet, instantiateKeySet, instantiateValues, isEmpty, keySet, size, toString, 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, newHashMap, newHashMap, newHashSet, newHashSet, 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 java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Field Detail
-
m_store
protected CacheStore m_store
The CacheStore to delegate all Map operations to.
-
m_fBlind
protected boolean m_fBlind
True means that put() and remove() can return null, regardless of the presence of an old value.
-
m_fStoreUnsupported
protected boolean m_fStoreUnsupported
True means that a call to the CacheStore store() method is assumed to be unsupported.
-
m_fEraseUnsupported
protected boolean m_fEraseUnsupported
True means that a call to the CacheStore erase() method is assumed to be unsupported.
-
-
Constructor Detail
-
ReadWriteMap
public ReadWriteMap(CacheStore store, boolean fBlind)
Construct a read/write CacheStoreMap.- Parameters:
store- the CacheStore to delegate read and write operations tofBlind- pass true to optimize put() and remove() by allowing them to skip the loading of old values
-
-
Method Detail
-
clear
public void clear()
Clear is explicitly not implemented.- Specified by:
clearin interfaceMap- Overrides:
clearin classAbstractKeyBasedMap
-
containsKey
public boolean containsKey(Object oKey)
Returns true if this map contains a mapping for the specified key.- Specified by:
containsKeyin interfaceMap- Overrides:
containsKeyin classAbstractKeyBasedMap- Returns:
- true if this map contains a mapping for the specified key, false otherwise.
-
get
public Object get(Object oKey)
Returns the value to which this map maps the specified key.- Specified by:
getin interfaceMap- Specified by:
getin classAbstractKeyBasedMap- Parameters:
oKey- the key object- Returns:
- the value to which this map maps the specified key, or null if the map contains no mapping for this key
-
getAll
public Map getAll(Collection colKeys)
Get all the specified keys, if they are in the Map. For each key that is in the cache, that key and its corresponding value will be placed in the map that is returned by this method. The absence of a key in the returned map indicates that it was not in the cache, which may imply (for caches that can load behind the scenes) that the requested data could not be loaded.- Overrides:
getAllin classAbstractKeyBasedMap- Parameters:
colKeys- a collection of keys that may be in the named cache- Returns:
- a Map of keys to values for the specified keys passed in colKeys
-
iterateKeys
protected Iterator iterateKeys()
Create an iterator over the keys in this Map. The Iterator must support remove() if the Map supports removal.- Specified by:
iterateKeysin classAbstractKeyBasedMap- Returns:
- a new instance of an Iterator over the keys in this Map
-
put
public Object put(Object oKey, Object oValue)
Associates the specified value with the specified key in this map.- Specified by:
putin interfaceMap- Overrides:
putin classAbstractKeyBasedMap- Parameters:
oKey- key with which the specified value is to be associatedoValue- value to be associated with the specified key- Returns:
- previous value associated with specified key, or null if there was no mapping for key
-
putAll
public void putAll(Map map)
Copies all of the mappings from the specified map to this map. The effect of this call is equivalent to that of callingAbstractKeyBasedMap.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.- Specified by:
putAllin interfaceMap- Overrides:
putAllin classAbstractKeyBasedMap- Parameters:
map- the Map containing the key/value pairings to put into this Map
-
remove
public Object remove(Object oKey)
Removes the mapping for this key from this map if present. Expensive: updates both the underlying cache and the local cache.- Specified by:
removein interfaceMap- Overrides:
removein classAbstractKeyBasedMap- Parameters:
oKey- key whose mapping is to be removed from the map- 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.
-
removeBlind
protected boolean removeBlind(Object oKey)
Removes the mapping for this key from this map if present. This method exists to allow sub-classes to optimize remove functionality for situations in which the original value is not required.- Overrides:
removeBlindin classAbstractKeyBasedMap- Parameters:
oKey- key whose mapping is to be removed from the map- Returns:
- true iff the Map changed as the result of this operation
-
isBlindPutAllowed
protected boolean isBlindPutAllowed()
Determine if the "blind put" optimization is possible.- Returns:
- true if put() can return null, regardless of the presence of an old value
-
isBlindRemoveAllowed
protected boolean isBlindRemoveAllowed()
Determine if the "blind remove" optimization is possible.- Returns:
- true if remove() can return null, regardless of the presence of an old value
-
isStoreUnsupported
protected boolean isStoreUnsupported()
Determine if the CacheStore has been determined to be read-only for store() operations.- Returns:
- true if any store() operations have failed due to UOE
-
isEraseUnsupported
protected boolean isEraseUnsupported()
Determine if the CacheStore has been determined to be read-only for erase() operations.- Returns:
- true if any store() operations have failed due to UOE
-
-