Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


com.tangosol.net.cache
Class CacheStoreMap.ReadWriteMap

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.AbstractKeyBasedMap
          extended by com.tangosol.net.cache.CacheStoreMap.ReadWriteMap

All Implemented Interfaces:
java.util.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.EntrySet, AbstractKeyBasedMap.KeySet, AbstractKeyBasedMap.ValuesCollection

 

Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry

 

Field Summary
protected  boolean m_fBlind
          True means that put() and remove() can return null, regardless of the presence of an old value.
protected  boolean m_fEraseUnsupported
          True means that a call to the CacheStore erase() method is assumed to be unsupported.
protected  boolean m_fStoreUnsupported
          True means that a call to the CacheStore store() method is assumed to be unsupported.
protected  CacheStore m_store
          The CacheStore to delegate all Map operations to.

 

Constructor Summary
CacheStoreMap.ReadWriteMap(CacheStore store, boolean fBlind)
          Construct a read/write CacheStoreMap.

 

Method Summary
 void clear()
          Clear is explicitly not implemented.
 boolean containsKey(java.lang.Object oKey)
          Returns true if this map contains a mapping for the specified key.
 java.lang.Object get(java.lang.Object oKey)
          Returns the value to which this map maps the specified key.
 java.util.Map getAll(java.util.Collection colKeys)
          Get all the specified keys, if they are in the Map.
protected  boolean isBlindPutAllowed()
          Determine if the "blind put" optimization is possible.
protected  boolean isBlindRemoveAllowed()
          Determine if the "blind remove" optimization is possible.
protected  boolean isEraseUnsupported()
          Determine if the CacheStore has been determined to be read-only for erase() operations.
protected  boolean isStoreUnsupported()
          Determine if the CacheStore has been determined to be read-only for store() operations.
protected  java.util.Iterator iterateKeys()
          Create an iterator over the keys in this Map.
 java.lang.Object put(java.lang.Object oKey, java.lang.Object oValue)
          Associates the specified value with the specified key in this map.
 void putAll(java.util.Map map)
          Copies all of the mappings from the specified map to this map.
 java.lang.Object remove(java.lang.Object oKey)
          Removes the mapping for this key from this map if present.
protected  boolean removeBlind(java.lang.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

 

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

CacheStoreMap.ReadWriteMap

public CacheStoreMap.ReadWriteMap(CacheStore store,
                                  boolean fBlind)
Construct a read/write CacheStoreMap.
Parameters:
store - the CacheStore to delegate read and write operations to
fBlind - 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:
clear in interface java.util.Map
Overrides:
clear in class AbstractKeyBasedMap

containsKey

public boolean containsKey(java.lang.Object oKey)
Returns true if this map contains a mapping for the specified key.
Specified by:
containsKey in interface java.util.Map
Overrides:
containsKey in class AbstractKeyBasedMap
Parameters:
oKey - key whose presence in this map is to be tested.
Returns:
true if this map contains a mapping for the specified key, false otherwise.

get

public java.lang.Object get(java.lang.Object oKey)
Returns the value to which this map maps the specified key.
Specified by:
get in interface java.util.Map
Specified by:
get in 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
See Also:
Map.containsKey(Object)

getAll

public java.util.Map getAll(java.util.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:
getAll in class AbstractKeyBasedMap
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 java.util.Iterator iterateKeys()
Create an iterator over the keys in this Map. The Iterator must support remove() if the Map supports removal.
Specified by:
iterateKeys in class AbstractKeyBasedMap
Returns:
a new instance of an Iterator over the keys in this Map

put

public java.lang.Object put(java.lang.Object oKey,
                            java.lang.Object oValue)
Associates the specified value with the specified key in this map.
Specified by:
put in interface java.util.Map
Overrides:
put in 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

putAll

public void putAll(java.util.Map map)
Copies all of the mappings from the specified map to this map. The effect of this call is equivalent to that of calling AbstractKeyBasedMap.put(java.lang.Object, java.lang.Object) 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:
putAll in interface java.util.Map
Overrides:
putAll in class AbstractKeyBasedMap
Parameters:
map - the Map containing the key/value pairings to put into this Map

remove

public java.lang.Object remove(java.lang.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:
remove in interface java.util.Map
Overrides:
remove in 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.

removeBlind

protected boolean removeBlind(java.lang.Object oKey)
Removes the mapping for this key from this map if present. This method exists to allow sub-classes to optmiize remove functionalitly for situations in which the original value is not required.
Overrides:
removeBlind in 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

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

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.