Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


com.tangosol.net.cache
Class AbstractSerializationCache

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.AbstractKeyBasedMap
          extended by com.tangosol.util.AbstractKeySetBasedMap
              extended by com.tangosol.net.cache.SerializationMap
                  extended by com.tangosol.net.cache.AbstractSerializationCache

All Implemented Interfaces:
ObservableMap, Map
Direct Known Subclasses:
SerializationCache, SerializationPagedCache

public abstract class AbstractSerializationCache
extends SerializationMap
implements ObservableMap

An abstract base class for serialization-based caches.

Author:
cp 2005.12.12

Nested Class Summary

 

Nested classes/interfaces inherited from class com.tangosol.util.AbstractKeySetBasedMap
AbstractKeySetBasedMap.EntrySet, AbstractKeySetBasedMap.KeyIterator, AbstractKeySetBasedMap.KeySet, AbstractKeySetBasedMap.ValuesCollection

 

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

 

Constructor Summary
AbstractSerializationCache(BinaryStore store)
          Construct a serialization cache on top of a BinaryStore.
AbstractSerializationCache(BinaryStore store, boolean fBinaryMap)
          Construct a serialization cache on top of a BinaryStore, optionally storing only Binary keys and values.
AbstractSerializationCache(BinaryStore store, ClassLoader loader)
          Construct a serialization cache on top of a BinaryStore, using the passed ClassLoader for deserialization.

 

Method Summary
 void addMapListener(MapListener listener)
          Add a standard map listener that will receive all events (inserts, updates, deletes) that occur against the map, with the key, old-value and new-value included.
 void 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 clear()
          Clear all key/value mappings.
protected  void dispatchEvent(CacheEvent evt)
          Dispatch the passed event.
protected  void dispatchPendingEvent(Object oKey, int nId, Object oNewValue, boolean fSynthetic)
          Dispatch an event that has not yet occurred, allowing the cache to potentially avoid reading of the "original value" information.
abstract  void evict()
          Flush items that have expired.
protected  String getDescription()
          Assemble a human-readable description.
protected  MapListenerSupport getMapListenerSupport()
          Accessor for the MapListenerSupport for sub-classes.
protected  boolean hasListeners()
          Determine if this map has any listeners at all.
 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. 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.
 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.
protected  boolean removeBlind(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.
 void removeMapListener(MapListener listener)
          Remove a standard map listener that previously signed up for all events.
 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.

 

Methods inherited from class com.tangosol.net.cache.SerializationMap
containsValue, eraseStore, fromBinary, get, getBinaryStore, getCacheStatistics, getClassLoader, getInternalKeySet, getKeyMap, isBinaryMap, registerKey, setBinaryMap, setBinaryStore, setClassLoader, toBinary, toString, unregisterKey

 

Methods inherited from class com.tangosol.util.AbstractKeySetBasedMap
containsKey, instantiateEntrySet, instantiateKeyIterator, instantiateKeySet, instantiateValues, isEmpty, isInternalKeySetIteratorMutable, iterateKeys, size

 

Methods inherited from class com.tangosol.util.AbstractKeyBasedMap
clone, entrySet, equals, getAll, hashCode, keySet, values

 

Methods inherited from interface java.util.Map
containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, size, values

 

Constructor Detail

AbstractSerializationCache

public AbstractSerializationCache(BinaryStore store)
Construct a serialization cache on top of a BinaryStore.
Parameters:
store - the BinaryStore to use to write the serialized objects to

AbstractSerializationCache

public AbstractSerializationCache(BinaryStore store,
                                  ClassLoader loader)
Construct a serialization cache 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

AbstractSerializationCache

public AbstractSerializationCache(BinaryStore store,
                                  boolean fBinaryMap)
Construct a serialization cache 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

clear

public void clear()
Clear all key/value mappings.
Specified by:
clear in interface Map
Overrides:
clear in class SerializationMap

put

public Object put(Object oKey,
                  Object oValue)
Associates the specified value with the specified key in this map.
Specified by:
put in interface Map
Overrides:
put in class SerializationMap
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(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 Map
Overrides:
putAll in class SerializationMap
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:
remove in interface Map
Overrides:
remove in class SerializationMap
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 optmiize remove functionalitly for situations in which the original value is not required.
Overrides:
removeBlind in class SerializationMap
Parameters:
oKey - key whose mapping is to be removed from the map
Returns:
true iff the Map changed as the result of this operation

addMapListener

public void addMapListener(MapListener listener)
Add a standard map listener that will receive all events (inserts, updates, deletes) that occur against the map, with the key, old-value and new-value included. This has the same result as the following call:
   addMapListener(listener, (Filter) null, false);
 
Specified by:
addMapListener in interface ObservableMap
Parameters:
listener - the MapEvent listener to add

removeMapListener

public void removeMapListener(MapListener listener)
Remove a standard map listener that previously signed up for all events. This has the same result as the following call:
   removeMapListener(listener, (Filter) null);
 
Specified by:
removeMapListener in interface ObservableMap
Parameters:
listener - the listener to remove

addMapListener

public void addMapListener(MapListener listener,
                           Object oKey,
                           boolean fLite)
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 interface ObservableMap
Parameters:
listener - the MapEvent listener to add
oKey - the key that identifies the entry for which to raise events
fLite - true to indicate that the MapEvent objects do not have to include the OldValue and NewValue property values in order to allow optimizations

removeMapListener

public void removeMapListener(MapListener listener,
                              Object oKey)
Remove a map listener that previously signed up for events about a specific key.
Specified by:
removeMapListener in interface ObservableMap
Parameters:
listener - the listener to remove
oKey - the key that identifies the entry for which to raise events

addMapListener

public void addMapListener(MapListener listener,
                           Filter filter,
                           boolean fLite)
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 interface ObservableMap
Parameters:
listener - the MapEvent listener to add
filter - 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 (see MapEventFilter); null is equivalent to a filter that alway returns true
fLite - true to indicate that the MapEvent objects do not have to include the OldValue and NewValue property values in order to allow optimizations

removeMapListener

public void removeMapListener(MapListener listener,
                              Filter filter)
Remove a map listener that previously signed up for events based on a filter evaluation.
Specified by:
removeMapListener in interface ObservableMap
Parameters:
listener - the listener to remove
filter - the filter that was passed into the corresponding addMapListener() call

evict

public abstract void evict()
Flush items that have expired.
Since:
Coherence 3.2

getDescription

protected String getDescription()
Assemble a human-readable description.
Overrides:
getDescription in class SerializationMap
Returns:
a description of this Map

getMapListenerSupport

protected MapListenerSupport getMapListenerSupport()
Accessor for the MapListenerSupport for sub-classes.
Returns:
the MapListenerSupport, or null if there are no listeners

hasListeners

protected boolean hasListeners()
Determine if this map has any listeners at all.
Returns:
true iff this ObservableMap has at least one MapListener

dispatchPendingEvent

protected void dispatchPendingEvent(Object oKey,
                                    int nId,
                                    Object oNewValue,
                                    boolean fSynthetic)
Dispatch an event that has not yet occurred, allowing the cache to potentially avoid reading of the "original value" information.
Parameters:
oKey - the key which the event is related to
nId - the event ID
oNewValue - the new value
fSynthetic - true if the event is synthetic

dispatchEvent

protected void dispatchEvent(CacheEvent evt)
Dispatch the passed event.
Parameters:
evt - a CacheEvent object

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


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