Class ObservableSplittingBackingMap

    • Constructor Detail

      • ObservableSplittingBackingMap

        public ObservableSplittingBackingMap​(BackingMapManager bmm,
                                             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 Object put​(Object oKey,
                          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,
                                   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
      • 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
      • getName

        public 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
      • instantiateKeySet

        protected Set instantiateKeySet()
        Factory pattern: Create a Set that represents the keys in the Map
        Overrides:
        instantiateKeySet in class AbstractKeySetBasedMap
        Returns:
        a new instance of Set that represents the keys in the Map
      • getPartitionMap

        public 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 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()
        Invoked when all resources owned by the implementer can safely be released.

        Once disposed of the object should no longer be considered to be usable.

        Note the Disposable interface is compatible with try-with-resources which will automatically invoke this method.

        Specified by:
        dispose in interface 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
      • 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 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​(Map mapPart,
                                     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