Package com.tangosol.net.cache
Class SimpleSerializationMap
- java.lang.Object
- 
- com.tangosol.util.Base
- 
- com.tangosol.util.AbstractKeyBasedMap
- 
- com.tangosol.net.cache.SimpleSerializationMap
 
 
 
- 
- All Implemented Interfaces:
- Map
 
 public class SimpleSerializationMap extends AbstractKeyBasedMap Map implementation that stores and accesses its contents through an underlying BinaryStore. The Map does not maintain additional state, such as the keys that it contains, which allows it to manage very large sets of data. However, a number of operations that would normally be "free" are potentially very expensive with this implementation. For example,size()has to iterate through all the keys provided by the underlying BinaryStore, andcontainsKey(java.lang.Object)has to read the value from the underlying BinaryStore to prove its existence.- Since:
- Coherence 3.1
- Author:
- cp 2005.11.23
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class com.tangosol.util.AbstractKeyBasedMapAbstractKeyBasedMap.DeferredCacheEvent<K,V>, AbstractKeyBasedMap.EntrySet, AbstractKeyBasedMap.KeySet, AbstractKeyBasedMap.ValuesCollection
 - 
Nested classes/interfaces inherited from class com.tangosol.util.BaseBase.LoggingWriter
 
- 
 - 
Constructor SummaryConstructors Constructor Description SimpleSerializationMap(BinaryStore store)Construct a SimpleSerializationMap on top of a BinaryStore.SimpleSerializationMap(BinaryStore store, boolean fBinaryMap)Construct a SimpleSerializationMap on top of a BinaryStore, optionally storing only Binary keys and values.SimpleSerializationMap(BinaryStore store, ClassLoader loader)Construct a SimpleSerializationMap on top of a BinaryStore, using the passed ClassLoader for deserialization.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all key/value mappings.booleancontainsKey(Object oKey)Returns true if this map contains a mapping for the specified key.booleancontainsValue(Object oValue)Returns true if this Map maps one or more keys to the specified value.protected ObjectfromBinary(Binary bin)Translate the passed Binary object into an Object object.Objectget(Object oKey)Returns the value to which this map maps the specified key.BinaryStoregetBinaryStore()Returns the BinaryStore that this map uses for its storage.CacheStatisticsgetCacheStatistics()Returns the CacheStatistics for this cache.ClassLoadergetClassLoader()Returns the ClassLoader that this map uses for deserialization, if it has one.booleanisBinaryMap()Determine if the keys and values in this map are known to be all Binary.booleanisEmpty()Returns true if this map contains no key-value mappings.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.protected voidsetBinaryMap(boolean fBinary)Configure the Map to be aware that all the keys and values in the map are known to be Binary or not.protected voidsetBinaryStore(BinaryStore store)Configures the BinaryStore that this map will use for its storage.protected voidsetClassLoader(ClassLoader loader)Configure the ClassLoader that this map will use for deserialization.intsize()Returns the number of key-value mappings in this map.protected BinarytoBinary(Object o)Translate the passed Object object into an Binary object.StringtoString()Returns a string representation of this Map.- 
Methods inherited from class com.tangosol.util.AbstractKeyBasedMapclone, entrySet, equals, getAll, hashCode, instantiateEntrySet, instantiateKeySet, instantiateValues, keySet, values
 - 
Methods inherited from class com.tangosol.util.Baseazzert, 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.Objectfinalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.util.Mapcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
 
- 
 
- 
- 
- 
Constructor Detail- 
SimpleSerializationMappublic SimpleSerializationMap(BinaryStore store) Construct a SimpleSerializationMap on top of a BinaryStore.- Parameters:
- store- the BinaryStore to use to write the serialized objects to
 
 - 
SimpleSerializationMappublic SimpleSerializationMap(BinaryStore store, ClassLoader loader) Construct a SimpleSerializationMap on top of a BinaryStore, using the passed ClassLoader for deserialization.- Parameters:
- store- the BinaryStore to use to write the serialized objects to
- loader- the ClassLoader to use for deserialization
 
 - 
SimpleSerializationMappublic SimpleSerializationMap(BinaryStore store, boolean fBinaryMap) Construct a SimpleSerializationMap on top of a BinaryStore, optionally storing only Binary keys and values.- Parameters:
- store- the BinaryStore to use to write the serialized objects to
- fBinaryMap- true indicates that this map will only manage binary keys and values
 
 
- 
 - 
Method Detail- 
clearpublic void clear() Clear all key/value mappings.- Specified by:
- clearin interface- Map
- Overrides:
- clearin class- AbstractKeyBasedMap
 
 - 
containsKeypublic boolean containsKey(Object oKey) Returns true if this map contains a mapping for the specified key.- Specified by:
- containsKeyin interface- Map
- Overrides:
- containsKeyin class- AbstractKeyBasedMap
- Returns:
- true if this map contains a mapping for the specified key, false otherwise.
 
 - 
containsValuepublic boolean containsValue(Object oValue) Returns true if this Map maps one or more keys to the specified value.- Specified by:
- containsValuein interface- Map
- Overrides:
- containsValuein class- AbstractKeyBasedMap
- Returns:
- true if this Map maps one or more keys to the specified value, false otherwise
 
 - 
getpublic Object get(Object oKey) Returns the value to which this map maps the specified key.- Specified by:
- getin interface- Map
- Specified by:
- getin class- AbstractKeyBasedMap
- 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
 
 - 
isEmptypublic boolean isEmpty() Returns true if this map contains no key-value mappings.- Specified by:
- isEmptyin interface- Map
- Overrides:
- isEmptyin class- AbstractKeyBasedMap
- Returns:
- true if this map contains no key-value mappings
 
 - 
putpublic Object put(Object oKey, Object oValue) Associates the specified value with the specified key in this map.- Specified by:
- putin interface- Map
- Overrides:
- putin class- AbstractKeyBasedMap
- Parameters:
- oKey- key with which the specified value is to be associated
- oValue- value to be associated with the specified key
- Returns:
- previous value associated with specified key, or null if there was no mapping for key
 
 - 
putAllpublic 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 interface- Map
- Overrides:
- putAllin class- AbstractKeyBasedMap
- Parameters:
- map- the Map containing the key/value pairings to put into this Map
 
 - 
removepublic 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 interface- Map
- Overrides:
- removein class- AbstractKeyBasedMap
- 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.
 
 - 
sizepublic int size() Returns the number of key-value mappings in this map.- Specified by:
- sizein interface- Map
- Overrides:
- sizein class- AbstractKeyBasedMap
- Returns:
- the number of key-value mappings in this map
 
 - 
iterateKeysprotected Iterator iterateKeys() Create an iterator over the keys in this Map. The Iterator must support remove() if the Map supports removal.- Specified by:
- iterateKeysin class- AbstractKeyBasedMap
- Returns:
- a new instance of an Iterator over the keys in this Map
 
 - 
removeBlindprotected 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 class- AbstractKeyBasedMap
- Parameters:
- oKey- key whose mapping is to be removed from the map
- Returns:
- true iff the Map changed as the result of this operation
 
 - 
toStringpublic String toString() Returns a string representation of this Map. The string representation consists of a list of key-value mappings in the order returned by the Map's entrySet view's iterator, enclosed in braces ("{}"). Adjacent mappings are separated by the characters ", " (comma and space). Each key-value mapping is rendered as the key followed by an equals sign ("=") followed by the associated value. Keys and values are converted to strings as by String.valueOf(Object).- Overrides:
- toStringin class- AbstractKeyBasedMap
- Returns:
- a String representation of this Map
 
 - 
getBinaryStorepublic BinaryStore getBinaryStore() Returns the BinaryStore that this map uses for its storage.Note: This implementation assumes that the BinaryStore is only being modified by this Map instance. If you modify the BinaryStore contents, the behavior of this Map is undefined. - Returns:
- the BinaryStore
 
 - 
setBinaryStoreprotected void setBinaryStore(BinaryStore store) Configures the BinaryStore that this map will use for its storage.- Parameters:
- store- the BinaryStore to use
 
 - 
getClassLoaderpublic ClassLoader getClassLoader() Returns the ClassLoader that this map uses for deserialization, if it has one.- Returns:
- the ClassLoader that this map uses for deserialization; may be null
 
 - 
setClassLoaderprotected void setClassLoader(ClassLoader loader) Configure the ClassLoader that this map will use for deserialization.- Parameters:
- loader- the ClassLoader that this map should use for deserialization
 
 - 
isBinaryMappublic boolean isBinaryMap() Determine if the keys and values in this map are known to be all Binary.- Returns:
- true if all keys and values will be Binary to start with, and thus will not require conversion
 
 - 
setBinaryMapprotected void setBinaryMap(boolean fBinary) Configure the Map to be aware that all the keys and values in the map are known to be Binary or not.- Parameters:
- fBinary- pass true if all keys and values will be Binary
 
 - 
getCacheStatisticspublic CacheStatistics getCacheStatistics() Returns the CacheStatistics for this cache.- Returns:
- a CacheStatistics object
 
 - 
toBinaryprotected Binary toBinary(Object o) Translate the passed Object object into an Binary object.- Parameters:
- o- the Object to serialize into a Binary object
- Returns:
- the Binary object
 
 
- 
 
-