Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


com.tangosol.net.partition
Class ObservableSplittingBackingMap

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.util.WrapperObservableMap
                  extended by com.tangosol.net.partition.ObservableSplittingBackingMap

All Implemented Interfaces:
com.oracle.common.base.Disposable, CacheMap, PartitionAwareBackingMap, ObservableMap, java.util.Map
Direct Known Subclasses:
ObservableSplittingBackingCache

public class ObservableSplittingBackingMap
extends WrapperObservableMap
implements CacheMap, com.oracle.common.base.Disposable, PartitionAwareBackingMap

An observable, cache-aware PartitionAwareBackingMap implementation.

Since:
Coherence 3.5
Author:
cp 2009-01-09

Nested Class Summary

 

Nested classes/interfaces inherited from class com.tangosol.util.WrapperObservableMap
WrapperObservableMap.InternalListener

 

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
java.util.Map.Entry

 

Field Summary

 

Fields inherited from class com.tangosol.util.WrapperObservableMap
m_fDeferredEvent, m_fTranslateEvents, m_listenerInternal, m_listenerSupport, m_map, m_stats

 

Fields inherited from interface com.tangosol.net.cache.CacheMap
EXPIRY_DEFAULT, EXPIRY_NEVER

 

Constructor Summary
ObservableSplittingBackingMap(BackingMapManager bmm, java.lang.String sName)
          Create a ObservableSplittingBackingMap that will delegate each partition's data and operations to a separate backing map.
ObservableSplittingBackingMap(PartitionAwareBackingMap map)
          Create a ObservableSplittingBackingMap that will delegate each partition's data and operations to a separate backing map.

 

Method Summary
 void addMapListener(MapListener listener, Filter filter, boolean fLite)
          Add a map listener that receives events based on a filter evaluation.
 void addMapListener(MapListener listener, java.lang.Object oKey, boolean fLite)
          Add a map listener for a specific key.
 void createPartition(int nPid)
          Add a partition to the PartitionAwareBackingMap.
 void destroyPartition(int nPid)
          Remove a partition from the PartitionAwareBackingMap.
 void dispose()
          
 BackingMapManager getBackingMapManager()
          Obtain the BackingMapManager that this PartitionAwareBackingMap uses to instantiate and release backing maps.
 CacheStatistics getCacheStatistics()
          Return the CacheStatistics for this cache.
 java.lang.String getName()
          Determine the name of the cache for which this PartitionAwareBackingMap exists.
 java.util.Map getPartitionMap(int nPid)
          Obtain a Map view for the data in a specific partition.
 java.util.Map getPartitionMap(PartitionSet partitions)
          Obtain a Map view for the data in a specific set of partitions.
 PartitionSplittingBackingMap getPartitionSplittingBackingMap()
          Obtain the underlying PartitionSplittingBackingMap.
 boolean isCollectStats()
          Check whether or not statistics are collected by the wrapper.
protected  boolean isEventFabricator()
          Determine if this ObservableMap has to fabricate events itself.
protected  void prepareUpdate(java.util.Map mapPart, java.util.Map mapUpdate)
          Prepare mapPart, a map representing a partition, for the impending changes in which all of the mappings from mapUpdate will be copied to mapPart.
 java.lang.Object put(java.lang.Object oKey, java.lang.Object oValue, long cMillis)
          Associates the specified value with the specified key in this cache.
 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, java.lang.Object oKey)
          Remove a map listener that previously signed up for events about a specific key.
 void setTranslateEvents(boolean fTranslate)
          Specify whether or not an event source has to be translated by the wrapper.
 java.lang.String toString()
          Return a human-readable description for this ObservableSplittingBackingMap.

 

Methods inherited from class com.tangosol.util.WrapperObservableMap
addMapListener, clear, containsValue, dispatchEvent, dispatchPendingEvent, ensureInternalListener, ensureMapListenerSupport, get, getDescription, getInternalKeySet, getMap, getMapListenerSupport, hasListeners, instantiateInternalListener, isInternalKeySetIteratorMutable, isSynthetic, isTranslateEvents, put, putAll, remove, removeBlind, removeMapListener, setCollectStats

 

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

 

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

 

Methods inherited from interface com.tangosol.net.cache.CacheMap
getAll, put

 

Methods inherited from interface com.tangosol.util.ObservableMap
addMapListener, removeMapListener

 

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

 

Constructor Detail

ObservableSplittingBackingMap

public ObservableSplittingBackingMap(BackingMapManager bmm,
                                     java.lang.String sName)
Create a ObservableSplittingBackingMap that will delegate each partition's data and operations to a separate backing map.
Parameters:
bmm - a callback that knows how to create and release the backing maps that this PartitionSplittingBackingMap is responsible for
sName - the cache name for which this backing map exists

ObservableSplittingBackingMap

public ObservableSplittingBackingMap(PartitionAwareBackingMap map)
Create a ObservableSplittingBackingMap that will delegate each partition's data and operations to a separate backing map.
Parameters:
map - the PartitionAwareBackingMap to delegate to

Method Detail

put

public java.lang.Object put(java.lang.Object oKey,
                            java.lang.Object oValue,
                            long cMillis)
Associates the specified value with the specified key in this cache. If the cache previously contained a mapping for this key, the old value is replaced. This variation of the CacheMap.put(Object oKey, Object oValue) method allows the caller to specify an expiry (or "time to live") for the cache entry.
Specified by:
put in interface CacheMap
Parameters:
oKey - key with which the specified value is to be associated
oValue - value to be associated with the specified key
cMillis - the number of milliseconds until the cache entry will expire, also referred to as the entry's "time to live"; pass CacheMap.EXPIRY_DEFAULT to use the cache's default time-to-live setting; pass CacheMap.EXPIRY_NEVER to indicate that the cache entry should never expire; this milliseconds value is not a date/time value, such as is returned from System.currentTimeMillis()
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

addMapListener

public void addMapListener(MapListener listener,
                           java.lang.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
Overrides:
addMapListener in class WrapperObservableMap
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,
                              java.lang.Object oKey)
Remove a map listener that previously signed up for events about a specific key.
Specified by:
removeMapListener in interface ObservableMap
Overrides:
removeMapListener in class WrapperObservableMap
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
Overrides:
addMapListener in class WrapperObservableMap
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
Overrides:
removeMapListener in class WrapperObservableMap
Parameters:
listener - the listener to remove
filter - the filter that was passed into the corresponding addMapListener() call

getBackingMapManager

public BackingMapManager getBackingMapManager()
Obtain the BackingMapManager that this PartitionAwareBackingMap uses to instantiate and release backing maps.
Specified by:
getBackingMapManager in interface PartitionAwareBackingMap
Returns:
the BackingMapManager

getName

public java.lang.String getName()
Determine the name of the cache for which this PartitionAwareBackingMap exists.
Specified by:
getName in interface PartitionAwareBackingMap
Returns:
the cache name

createPartition

public void createPartition(int nPid)
Add a partition to the PartitionAwareBackingMap.
Specified by:
createPartition in interface PartitionAwareBackingMap
Parameters:
nPid - the partition id that the PartitionAwareBackingMap will be responsible for, starting at this instant

destroyPartition

public void destroyPartition(int nPid)
Remove a partition from the PartitionAwareBackingMap.
Specified by:
destroyPartition in interface PartitionAwareBackingMap
Parameters:
nPid - the partition id that the PartitionAwareBackingMap will no longer be responsible for, starting at this instant

getPartitionMap

public java.util.Map getPartitionMap(int nPid)
Obtain a Map view for the data in a specific partition.
Specified by:
getPartitionMap in interface PartitionAwareBackingMap
Parameters:
nPid - the partition ID
Returns:
the backing map (or null if that partition is not owned)

getPartitionMap

public java.util.Map getPartitionMap(PartitionSet partitions)
Obtain a Map view for the data in a specific set of partitions.
Specified by:
getPartitionMap in interface PartitionAwareBackingMap
Parameters:
partitions - the masking PartitionSet
Returns:
a read-only view into a subset of backing maps

dispose

public void dispose()
Specified by:
dispose in interface com.oracle.common.base.Disposable

getPartitionSplittingBackingMap

public PartitionSplittingBackingMap getPartitionSplittingBackingMap()
Obtain the underlying PartitionSplittingBackingMap.
Returns:
the underlying PartitionSplittingBackingMap

isEventFabricator

protected boolean isEventFabricator()
Determine if this ObservableMap has to fabricate events itself.
Overrides:
isEventFabricator in class WrapperObservableMap
Returns:
true if events are expected, but the wrapped Map does not generate any events itself

setTranslateEvents

public void setTranslateEvents(boolean fTranslate)
Specify whether or not an event source has to be translated by the wrapper.

Note: this setting is only meaningful if the underlying map is an ObservableMap itself.

Overrides:
setTranslateEvents in class WrapperObservableMap
Parameters:
fTranslate - true if this wrapper should translate an event source; false otherwise

getCacheStatistics

public CacheStatistics getCacheStatistics()
Return the CacheStatistics for this cache.
Overrides:
getCacheStatistics in class WrapperObservableMap
Returns:
a CacheStatistics object

isCollectStats

public boolean isCollectStats()
Check whether or not statistics are collected by the wrapper.
Overrides:
isCollectStats in class WrapperObservableMap
Returns:
true if this wrapper collects cache statistics; false otherwise

toString

public java.lang.String toString()
Return a human-readable description for this ObservableSplittingBackingMap.
Overrides:
toString in class WrapperObservableMap
Returns:
a String description of the ObservableSplittingBackingMap

prepareUpdate

protected void prepareUpdate(java.util.Map mapPart,
                             java.util.Map mapUpdate)
Prepare mapPart, a map representing a partition, for the impending changes in which all of the mappings from mapUpdate will be copied to mapPart.
Parameters:
mapPart - the map to be mutated with the contents of mapUpdate
mapUpdate - the map of changes to be applied

Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


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