public class SerializationMap extends AbstractKeySetBasedMap
This implementation is mostly thread safe. To be certain, it is suggested that access to this cache is either single-threaded or gated through an object like WrapperConcurrentMap.
AbstractKeySetBasedMap.EntrySet, AbstractKeySetBasedMap.KeyIterator, AbstractKeySetBasedMap.KeySet, AbstractKeySetBasedMap.ValuesCollection
AbstractKeyBasedMap.DeferredCacheEvent<K,V>
Base.LoggingWriter, Base.StackFrame
Constructor and Description |
---|
SerializationMap(BinaryStore store)
Construct a SerializationMap on top of a BinaryStore.
|
SerializationMap(BinaryStore store,
boolean fBinaryMap)
Construct a SerializationMap on top of a BinaryStore, optionally
storing only Binary keys and values.
|
SerializationMap(BinaryStore store,
ClassLoader loader)
Construct a SerializationMap on top of a BinaryStore, using the passed
ClassLoader for deserialization.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all key/value mappings.
|
boolean |
containsValue(Object oValue)
Returns true if this Map maps one or more keys to the
specified value.
|
protected void |
eraseStore()
Erase all entries from the underlying store.
|
protected Object |
fromBinary(Binary bin)
Translate the passed Binary object into an Object object.
|
Object |
get(Object oKey)
Returns the value to which this map maps the specified key.
|
BinaryStore |
getBinaryStore()
Returns the BinaryStore that this map uses for its storage.
|
CacheStatistics |
getCacheStatistics()
Returns the CacheStatistics for this cache.
|
ClassLoader |
getClassLoader()
Returns the ClassLoader that this map uses for deserialization, if it
has one.
|
protected String |
getDescription()
Assemble a human-readable description.
|
protected Set |
getInternalKeySet()
Obtain a set of keys that are represented by this Map.
|
protected Map |
getKeyMap()
Returns the cache of keys that are in the SerializationMap.
|
protected Map |
instantiateKeyMap()
Instantiate a key-map.
|
boolean |
isBinaryMap()
Determine if the keys and values in this map are known to be all
Binary.
|
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 |
registerKey(Object oKey,
Binary binKey,
Binary binValue)
Register a new key for the SerializationMap.
|
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 |
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.
|
protected void |
setBinaryStore(BinaryStore store)
Configures the BinaryStore that this map will use for its storage.
|
protected void |
setClassLoader(ClassLoader loader)
Configure the ClassLoader that this map will use for deserialization.
|
protected Binary |
toBinary(Object o)
Translate the passed Object object into an Binary object.
|
String |
toString()
Returns a string representation of this Map.
|
protected void |
unregisterKey(Object oKey)
Unregister a key from the SerializationMap.
|
containsKey, instantiateEntrySet, instantiateKeyIterator, instantiateKeySet, instantiateValues, isEmpty, isInternalKeySetIteratorMutable, iterateKeys, size
clone, entrySet, equals, getAll, hashCode, keySet, values
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
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public SerializationMap(BinaryStore store)
store
- the BinaryStore to use to write the serialized objects topublic SerializationMap(BinaryStore store, ClassLoader loader)
store
- the BinaryStore to use to write the serialized objects toloader
- the ClassLoader to use for deserializationpublic SerializationMap(BinaryStore store, boolean fBinaryMap)
store
- the BinaryStore to use to write the serialized
objects tofBinaryMap
- true indicates that this map will only manage
binary keys and valuespublic void clear()
clear
in interface Map
clear
in class AbstractKeyBasedMap
public boolean containsValue(Object oValue)
containsValue
in interface Map
containsValue
in class AbstractKeyBasedMap
public Object get(Object oKey)
get
in interface Map
get
in class AbstractKeyBasedMap
oKey
- the key objectpublic Object put(Object oKey, Object oValue)
put
in interface Map
put
in class AbstractKeyBasedMap
oKey
- 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 Map
putAll
in class AbstractKeyBasedMap
map
- the Map containing the key/value pairings to put into this
Mappublic Object remove(Object oKey)
remove
in interface Map
remove
in class AbstractKeyBasedMap
oKey
- key whose mapping is to be removed from the mapprotected Set getInternalKeySet()
The AbstractKeySetBasedMap only utilizes the internal key set as a read-only resource.
getInternalKeySet
in class AbstractKeySetBasedMap
protected boolean removeBlind(Object oKey)
removeBlind
in class AbstractKeyBasedMap
oKey
- key whose mapping is to be removed from the mappublic String toString()
toString
in class AbstractKeyBasedMap
public BinaryStore getBinaryStore()
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.
protected void setBinaryStore(BinaryStore store)
store
- the BinaryStore to usepublic ClassLoader getClassLoader()
protected void setClassLoader(ClassLoader loader)
loader
- the ClassLoader that this map should use for
deserializationpublic boolean isBinaryMap()
protected void setBinaryMap(boolean fBinary)
fBinary
- pass true if all keys and values will be Binaryprotected Map getKeyMap()
public CacheStatistics getCacheStatistics()
protected String getDescription()
protected void registerKey(Object oKey, Binary binKey, Binary binValue)
oKey
- the key that has been added to the mapbinKey
- the binary form of the keybinValue
- the binary form of the valueprotected void unregisterKey(Object oKey)
oKey
- the key that has been removed from the mapprotected Binary toBinary(Object o)
o
- the Object to serialize into a Binary objectprotected Object fromBinary(Binary bin)
bin
- the Binary object to deserializeprotected void eraseStore()
protected Map instantiateKeyMap()