Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.4.0)

E90870-01

coherence/util/MapListenerSupport.hpp

00001 /*
00002 * MapListenerSupport.hpp
00003 *
00004 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
00005 *
00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
00007 * affiliates.
00008 *
00009 * This software is the confidential and proprietary information of Oracle
00010 * Corporation. You shall not disclose such confidential and proprietary
00011 * information and shall use it only in accordance with the terms of the
00012 * license agreement you entered into with Oracle.
00013 *
00014 * This notice may not be removed or altered.
00015 */
00016 #ifndef COH_MAP_LISTENER_SUPPORT_HPP
00017 #define COH_MAP_LISTENER_SUPPORT_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/net/cache/CacheEvent.hpp"
00022 #include "coherence/util/Converter.hpp"
00023 #include "coherence/util/Filter.hpp"
00024 #include "coherence/util/Listeners.hpp"
00025 #include "coherence/util/MapEvent.hpp"
00026 #include "coherence/util/MapListener.hpp"
00027 #include "coherence/util/MultiplexingMapListener.hpp"
00028 #include "coherence/util/Set.hpp"
00029 #include "coherence/util/SynchronousListener.hpp"
00030 
00031 COH_OPEN_NAMESPACE2(coherence,util)
00032 
00033 using coherence::net::cache::CacheEvent;
00034 
00035 
00036 /**
00037 * This class provides support for advanced MapListener functionality.
00038 *
00039 * @author js  2008.06.10
00040 */
00041 class COH_EXPORT MapListenerSupport
00042     : public class_spec<MapListenerSupport>
00043     {
00044     friend class factory<MapListenerSupport>;
00045 
00046     // ----- constructors ---------------------------------------------------
00047 
00048     protected:
00049         /**
00050         * Create a new MapListenerSupport.
00051         */
00052         MapListenerSupport();
00053 
00054 
00055     // ----- MapListenerSupport interface -----------------------------------
00056 
00057     public:
00058         /**
00059         * Add a map listener that receives events based on a filter
00060         * evaluation.
00061         *
00062         * @param hListener  the listener to add
00063         * @param vFilter    a filter that will be passed MapEvent objects to
00064         *                   select from; a MapEvent will be delivered to the
00065         *                   listener only if the filter evaluates to true for
00066         *                   that MapEvent; NULL is equivalent to a filter
00067         *                   that alway returns true
00068         * @param fLite      true to indicate that the MapEvent objects do not
00069         *                   have to include the OldValue and NewValue
00070         *                   property values in order to allow optimizations
00071         */
00072         virtual void addListener(MapListener::Handle hListener,
00073                 Filter::View vFilter, bool fLite);
00074 
00075         /**
00076         * Add a map listener for a specific key.
00077         *
00078         * @param hListener  the listener to add
00079         * @param vKey       the key that identifies the entry for which to
00080         *                   raise events
00081         * @param fLite      true to indicate that the MapEvent objects do not
00082         *                   have to include the OldValue and NewValue
00083         *                   property values in order to allow optimizations
00084         *
00085         */
00086         virtual void addListener(MapListener::Handle hListener,
00087                 Object::View vKey, bool fLite);
00088 
00089         /**
00090         * Remove a map listener that previously signed up for events based on
00091         * a filter evaluation.
00092         *
00093         * @param vListener  the listener to remove
00094         * @param vFilter    a filter used to evaluate events
00095         */
00096         virtual void removeListener(MapListener::View vListener,
00097                 Filter::View vFilter);
00098 
00099         /**
00100         * Remove a map listener that previously signed up for events about a
00101         * specific key.
00102         *
00103         * @param vListener  the listener to remove
00104         * @param vKey       the key that identifies the entry for which to
00105         *                   raise events
00106         */
00107         virtual void removeListener(MapListener::View vListener,
00108                 Object::View vKey);
00109 
00110         /**
00111         * Remove all signed up listeners.
00112         */
00113         virtual void clear();
00114 
00115         /**
00116         * Checks whether or not this MapListenerSupport object contains
00117         * any listeners.
00118         *
00119         * @return true iff there are no listeners encapsulated by this
00120         *         MapListenerSupport object
00121         */
00122         virtual bool isEmpty() const;
00123 
00124         /**
00125         * Checks whether or not this MapListenerSupport object contains
00126         * any listeners for a given filter.
00127         *
00128         * @param vFilter  the filter
00129         *
00130         * @return true iff there are no listeners for the specified filter
00131         *              encapsulated by this MapListenerSupport object
00132         */
00133         virtual bool isEmpty(Filter::View vFilter) const;
00134 
00135         /**
00136         * Checks whether or not this MapListenerSupport object contains
00137         * any listeners for a given key.
00138         *
00139         * @param vKey  the key
00140         *
00141         * @return true iff there are no listeners for the specified filter
00142         *              encapsulated by this MapListenerSupport object
00143         */
00144         virtual bool isEmpty(Object::View vKey) const;
00145 
00146         /**
00147         * Checks whether or not this MapListenerSupport object contains
00148         * any standard (not lite) listeners for a given filter.
00149         *
00150         * @param vFilter  the filter
00151         *
00152         * @return true iff there are no standard listeners for the specified
00153         *              filter encapsulated by this MapListenerSupport object
00154         */
00155         virtual bool containsStandardListeners(
00156                 Filter::View vFilter) const;
00157 
00158         /**
00159         * Checks whether or not this MapListenerSupport object contains
00160         * any standard (not lite) listeners for a given key.
00161         *
00162         * @param vKey  the key
00163         *
00164         * @return true iff there are no standard listeners for the specified
00165         *              filter encapsulated by this MapListenerSupport object
00166         */
00167         virtual bool containsStandardListeners(Object::View vKey) const;
00168 
00169         /**
00170         * Obtain a set of all filters that have assosiated global listeners.
00171         * <p>
00172         * <b>Note</b>: The returned value must be treated as an immutable.
00173         *
00174         * @return a set of all filters that have assosiated global listeners
00175         */
00176         virtual Set::View getFilterSet() const;
00177 
00178         /**
00179         * Obtain a set of all keys that have assosiated key listeners.
00180         * <p>
00181         * <b>Note</b>: The returned value must be treated as an immutable.
00182         *
00183         * @return a set of all keys that have assosiated key listeners
00184         */
00185         virtual Set::View getKeySet() const;
00186 
00187         /**
00188         * Obtain the Listeners object for a given filter.
00189         *
00190         * @param vFilter  the filter
00191         *
00192         * @return the Listeners object for the filter; NULL if none exists
00193         */
00194         virtual Listeners::View getListeners(Filter::View vFilter) const;
00195 
00196         /**
00197         * Obtain the Listeners object for a given key.
00198         *
00199         * @param vKey  the key
00200         *
00201         * @return the Listeners object for the key; NULL if none exists
00202         */
00203         virtual Listeners::View getListeners(Object::View vKey) const;
00204 
00205         /**
00206         * Collect all Listeners that should be notified for a given event.
00207         * <p>
00208         * <b>Note</b>: The returned value must be treated as an immutable.
00209         *
00210         * @param vEvent the MapEvent object
00211         *
00212         * @return the Listeners object containing the relevant listeners
00213         */
00214         virtual Listeners::View collectListeners(MapEvent::View vEvent);
00215 
00216         /**
00217         * Fire the specified map event.
00218         *
00219         * @param hEvent    the map event
00220         * @param fStrict   if true then any RuntimeException thrown by event
00221         *                  handlers stops all further event processing and
00222         *                  the exception is re-thrown; if false then all
00223         *                  exceptions are logged and the process continues
00224         */
00225         virtual void fireEvent(MapEvent::Handle hEvent, bool fStrict);
00226 
00227         /**
00228         * Convert the specified map event into another MapEvent that ensures
00229         * the lazy event data conversion using the specified converters.
00230         *
00231         * @param vEvent    the map event
00232         * @param hmapConv  the source for the converted event
00233         * @param vConvKey  (optional) the key Converter
00234         * @param vConvVal  (optional) the value converter
00235         *
00236         * @return the converted MapEvent object
00237         */
00238         static MapEvent::Handle convertEvent(MapEvent::View vEvent,
00239                 ObservableMap::Handle hmapConv,
00240                 Converter::View vConvKey = NULL,
00241                 Converter::View vConvVal = NULL);
00242 
00243         /**
00244         * Transform the given MapEvent into a FilterEvent if it is not already a
00245         * FilterEvent and there are matching filters associated with the
00246         * specified Listeners object.
00247         *
00248         * @param hEvent      the MapEvent to transform, if necessary
00249         * @param vListeners  the Listeners object
00250         *
00251         * @return a FilterEvent if the given MapEvent is not a FilterEvent and
00252         *         the specified Listeners object has associated filters;
00253         *         otherwise, the given MapEvent
00254         * @since  Coherence 3.7.1.8
00255         */
00256         static MapEvent::Handle enrichEvent(MapEvent::Handle hEvent,
00257                 Listeners::View vListeners);
00258 
00259         /**
00260         * Unwrap the specified map event and return the underlying source event.
00261         *
00262         * @param vEvent  the event to unwrap
00263         *
00264         * @return the unwrapped event
00265         */
00266         static MapEvent::View unwrapEvent(MapEvent::View vEvent);
00267 
00268         /**
00269         * Check if the given listener is a PrimingListener or if it wraps one.
00270         *
00271         * @param listener  Map listener to check
00272         *
00273         * @return true iff the listener is a PrimingListener or wraps one
00274         *
00275         * @since 12.2.1
00276         */
00277         static bool isPrimingListener(MapListener::View listener);
00278 
00279 
00280     // ----- helper methods -------------------------------------------------
00281 
00282     protected:
00283         /**
00284         * Evaluate whether or not the specified event should be delivered to the
00285         * listener associated with the specified filter.
00286         *
00287         * @param vFilter  the filter
00288         * @param vEvent   the event
00289         *
00290         * @return true iff the event should be delivered to the corresponding listener
00291         */
00292         static bool evaluateEvent(Filter::View vFilter, MapEvent::View vEvent);
00293 
00294         /**
00295         * Return true iff the specified event represents a transformed CacheEvent.
00296         *
00297         * @param vEvent  the event to test
00298         *
00299         * @return true iff the event has been transformed
00300         */
00301         static bool isTransformedEvent(MapEvent::View vEvent);
00302 
00303         /**
00304         * Ensure that the specified map has a Listeners object assosiated
00305         * with the specified key and add the specified listener to it.
00306         *
00307         * @param hmapListeners  map of listeners
00308         * @param vKey           key of the listener
00309         * @param hListener      the listener to add
00310         */
00311         static void addSafeListener(Map::Handle hmapListeners,
00312                 Object::View vKey, MapListener::Handle hListener);
00313 
00314         /**
00315         * Ensure that the specified map has a Listeners object associated
00316         * with the specified Filter and add the specified listener to it.
00317         *
00318         * @param hmapListeners  map of listeners
00319         * @param vFilter        filter of the listener
00320         * @param hListener      the listener to add
00321         * @since Coherence 3.7.1.8
00322         */
00323         static void addSafeListener(Map::Handle hMapListeners,
00324                 Filter::View vAnyFilter, MapListener::Handle hListener);
00325 
00326         /**
00327         * Remove the specified listener from the Listeners object assosiated
00328         * with the specified key.
00329         *
00330         * @param hmapListeners  map of listeners
00331         * @param vKey           key of the listener
00332         * @param vListener      the listener to remove
00333         */
00334         static void removeSafeListener(Map::Handle hmapListeners,
00335                 Object::View vKey, MapListener::View vListener);
00336 
00337         /**
00338         * Add a state information (lite or standard) associated with
00339         * specified key and listener.
00340         *
00341         * @param hmapStandardListeners  map of standard listeners
00342         * @param vKey                   key of the listener
00343         * @param hListener              the listener to add
00344         * @param fLite                  true to indicate that the MapEvent
00345         *                               objects do not have to include the
00346         *                               OldValue and NewValue property values
00347         */
00348         static void addListenerState(Map::Handle hmapStandardListeners,
00349                 Object::View vKey, MapListener::Handle hListener,
00350                 bool fLite);
00351 
00352         /**
00353         * Remove a state information (lite or standard) assosiated with
00354         * specified key and listener.
00355         *
00356         * @param hmapStandardListeners  map of standard listeners
00357         * @param vKey                   key of the listener
00358         * @param vListener              the listener to remove
00359         */
00360         static void removeListenerState(Map::Handle hmapStandardListeners,
00361                 Object::View vKey, MapListener::View vListener);
00362 
00363         /**
00364         * Unwrap the specified map listener and return the underlying map listener.
00365         *
00366         * @param vListener  the listener to unwrap
00367         *
00368         * @return the unwrapped listener
00369         *
00370         * @since 12.2.1
00371         */
00372         static MapListener::View unwrapListener(MapListener::View vListener);
00373 
00374     // ----- Object interface -----------------------------------------------
00375 
00376     public:
00377         /**
00378         * {@inheritDoc}
00379         */
00380         virtual TypedHandle<const String> toString() const;
00381 
00382 
00383     // ----- inner class: FilterEvent ---------------------------------------
00384 
00385     public:
00386         /**
00387         * An extension of the CacheEvent which may carry no values (old or
00388         * new), but instead holds an array of Filter objects being the
00389         * "cause" of the event.
00390         */
00391         class COH_EXPORT FilterEvent
00392             : public class_spec<FilterEvent,
00393                 extends<CacheEvent> >
00394             {
00395             friend class factory<FilterEvent>;
00396 
00397             // ----- constructors ---------------------------------------
00398 
00399             protected:
00400                 /**
00401                 * Create a new FilterEvent with no old and new values.
00402                 *
00403                 * @param hMap        the map on which the Event initially
00404                 *                    occurred
00405                 * @param nId         the events id (entry_inserted |
00406                 *                    entry_updated | entry_deleted)
00407                 * @param vKey        the key into the map
00408                 * @param fSynthetic  true iff the event is caused by internal
00409                 *                    cache processing such as eviction or
00410                 *                    loading
00411                 * @param vaFilters   an array of Filters that caused this event.
00412                 */
00413                 FilterEvent(ObservableMap::Handle hMap, int32_t nId,
00414                         Object::View vKey, Object::View vValueOld,
00415                         Object::View vValueNew, bool fSynthetic,
00416                         ObjectArray::View vaFilters);
00417 
00418                 /**
00419                 * Create a new FilterEvent with no old and new values.
00420                 *
00421                 * @param hMap        the map on which the Event initially
00422                 *                    occurred
00423                 * @param nId         the events id (entry_inserted |
00424                 *                    entry_updated | entry_deleted)
00425                 * @param vKey        the key into the map
00426                 * @param fSynthetic  true iff the event is caused by internal
00427                 *                    cache processing such as eviction or
00428                 *                    loading
00429                 * @param fPriming    a flag indicating whether or not the event
00430                 *                    is a priming event
00431                 * @param vaFilters   an array of Filters that caused this event.
00432                 * @since 12.2.1.3.2
00433                 */
00434                 FilterEvent(ObservableMap::Handle hMap, int32_t nId,
00435                         Object::View vKey, Object::View vValueOld,
00436                         Object::View vValueNew, bool fSynthetic,
00437                         bool fPriming, ObjectArray::View vaFilters);
00438 
00439                 /**
00440                 * Create a new FilterEvent with no old and new values.
00441                 *
00442                 * @param hMap             the map on which the Event initially
00443                 *                         occurred
00444                 * @param nId              the events id (entry_inserted |
00445                 *                         entry_updated | entry_deleted)
00446                 * @param vKey             the key into the map
00447                 * @param fSynthetic       true iff the event is caused by internal
00448                 *                         cache processing such as eviction or
00449                 *                         loading
00450                 * @param nTransformState  the state describing how this event has 
00451                 *                         been or should be transformed
00452                 * @param vaFilters        an array of Filters that caused this event.
00453                 */
00454                 FilterEvent(ObservableMap::Handle hMap, int32_t nId,
00455                         Object::View vKey, Object::View vValueOld,
00456                         Object::View vValueNew, bool fSynthetic,
00457                         TransformationState nTransformState,
00458                         ObjectArray::View vaFilters);
00459 
00460                 /**
00461                 * Create a new FilterEvent with no old and new values.
00462                 *
00463                 * @param hMap             the map on which the Event initially
00464                 *                         occurred
00465                 * @param nId              the events id (entry_inserted |
00466                 *                         entry_updated | entry_deleted)
00467                 * @param vKey             the key into the map
00468                 * @param fSynthetic       true iff the event is caused by internal
00469                 *                         cache processing such as eviction or
00470                 *                         loading
00471                 * @param nTransformState  the state describing how this event has
00472                 *                         been or should be transformed
00473                 * @param fPriming         a flag indicating whether or not the event
00474                 *                         is a priming event
00475                 * @param vaFilters        an array of Filters that caused this event.
00476                 * @since 12.2.1.3.2
00477                 */
00478                 FilterEvent(ObservableMap::Handle hMap, int32_t nId,
00479                         Object::View vKey, Object::View vValueOld,
00480                         Object::View vValueNew, bool fSynthetic,
00481                         TransformationState nTransformState,
00482                         bool fPriming, ObjectArray::View vaFilters);
00483 
00484             // ----- FilterEvent interface ------------------------------
00485 
00486             public:
00487                 /**
00488                 * Return an array of filters that are the cause of this
00489                 * event.
00490                 *
00491                 * @return an array of filters
00492                 */
00493                 virtual ObjectArray::View getFilter() const;
00494 
00495                 /**
00496                 * Set the event that this FilterEvent wraps.
00497                 *
00498                 * @param vEvent  the wrapped event
00499                 * @since Coherence 3.7.1.8
00500                 */
00501                 virtual void setEvent(MapEvent::View vEvent);
00502 
00503             // ----- Describable interface ------------------------------
00504 
00505             public:
00506                 /**
00507                 * {@inheritDoc}
00508                 */
00509                 virtual String::View getDescription() const;
00510 
00511             // ----- MapEvent methods -----------------------------------
00512 
00513             public:
00514                 /**
00515                 * {@inheritDoc}
00516                 */
00517                 virtual Object::View getKey() const;
00518 
00519                 /**
00520                 * {@inheritDoc}
00521                 */
00522                 virtual Object::View getOldValue() const;
00523 
00524                 /**
00525                 * {@inheritDoc}
00526                 */
00527                 virtual Object::View getNewValue() const;
00528 
00529             // ----- helper methods -------------------------------------
00530 
00531             public:
00532                 /**
00533                 * Determine if this filter event contains a specified filter.
00534                 *
00535                 * @param vFilter  the filter to search for
00536                 *
00537                 * @return true if the event contained the specified filter,
00538                 *         false otherwise
00539                 */
00540                 virtual bool containsFilter(Filter::View vFilter) const;
00541 
00542             // ----- data members ---------------------------------------
00543 
00544             protected:
00545                 /**
00546                 * Filters which caused the event.
00547                 */
00548                 FinalView<ObjectArray> f_vaFilters;
00549 
00550                 /**
00551                 * Optional wrapped MapEvent.
00552                 * @since Coherence 3.7.1.8
00553                 */
00554                 FinalView<MapEvent> f_vEvent;
00555             };
00556 
00557 
00558     // ----- inner class: SynchronousListener -------------------------------
00559 
00560     public:
00561         /**
00562         * A tag interface indicating that tagged MapListener implementation
00563         * has to receive the MapEvent notifications in a synchronous manner.
00564         * <p>
00565         * Consider a MapListener that subscribes to receive notifications for
00566         * distributed (partitioned) cache. All events notifications are
00567         * received by the service thread and immediately queued to be
00568         * processed by the dedicated event dispatcher thread. This makes it
00569         * impossible to differentiate between the event caused by the updates
00570         * made by this thread and any other thread (possibly in a different
00571         * VM). Forcing the events to be processed on the service thread
00572         * guarantees that by the time "put" or "remove" requests return to
00573         * the caller all relevant MapEvent notification have been processed
00574         * (due to the "in order delivery" rule enforced by the TCMP).
00575         * <p>
00576         * This interface should be considered as a very advanced feature, so
00577         * a MapListener implementation that is tagged as a
00578         * SynchronousListener must exercise extreme caution during event
00579         * processing since any delay with return or unhandled exception will
00580         * cause a delay or complete shutdown of the corresponding cache
00581         * service.
00582         * <p>
00583         * <b>Note:</b> The contract by the event producer in respect to the
00584         * SynchronousListener is somewhat weaker then the general one.
00585         * First, the SynchronousListener implementaion should make no
00586         * assumptions about the event source obtained by {MapEvent#getMap()}.
00587         * Second, in the event of [automatic] service restart, the listener
00588         * has to be re-registered manually (for example, in response to the
00589         * {com::tangosol::net::MemberEvent#member_joined member_joined}
00590         * event). Third, and the most important, no calls against the
00591         * NamedCache are allowed during the synchronous event processing (the
00592         * only exception being a call to remove the listener itself).
00593         */
00594         class COH_EXPORT SynchronousListener
00595             : public interface_spec<SynchronousListener,
00596                 implements<coherence::util::SynchronousListener, MapListener> >
00597             {
00598             };
00599 
00600     // ----- inner class: PrimingListener ----------------------------------
00601 
00602     public:
00603         /**
00604          * A tag interface indicating that tagged MapListener implementation
00605          * has to receive the MapEvent notifications in a synchronous manner
00606          * for lite events (carrying only a key).
00607          * Additionally a "priming" event is generated when registering this listener.
00608          *
00609          * @since 12.2.1
00610          */
00611         class COH_EXPORT PrimingListener
00612             : public interface_spec<PrimingListener,
00613                 implements<SynchronousListener> >
00614             {
00615             };
00616 
00617 
00618     // ----- inner class: WrapperSynchronousListener ------------------------
00619 
00620     public:
00621         /**
00622         * A wrapper class that turns the specified MapListener into
00623         * a synchronous listener.
00624         */
00625         class COH_EXPORT WrapperSynchronousListener
00626             : public class_spec<WrapperSynchronousListener,
00627                 extends<MultiplexingMapListener>,
00628                 implements<SynchronousListener> >
00629             {
00630             friend class factory<WrapperSynchronousListener>;
00631 
00632             // ----- constructors ---------------------------------------
00633 
00634             protected:
00635                 /**
00636                 * Create a new WrapperSynchronousListener.
00637                 *
00638                 * @param hListener  the listener to be wrapped
00639                 *
00640                 * @return the new WrapperSynchronousListener instance
00641                 */
00642                 WrapperSynchronousListener(MapListener::Handle hListener);
00643 
00644             // ----- accessors ------------------------------------------
00645 
00646             public:
00647                 /**
00648                 * Get the underlying MapListener.
00649                 *
00650                 * @return the underlying listener
00651                 */
00652                 virtual MapListener::View getMapListener() const;
00653 
00654             // ----- MultiplexingMapListener interface ------------------
00655 
00656             public:
00657                 /**
00658                 * {@inheritDoc}
00659                 */
00660                 virtual void onMapEvent(MapEvent::View vEvent);
00661 
00662             // ----- Object interface -----------------------------------
00663 
00664             public:
00665                 /**
00666                 * {@inheritDoc}
00667                 */
00668                 virtual size32_t hashCode() const;
00669 
00670                 /**
00671                 * {@inheritDoc}
00672                 */
00673                 virtual bool equals(Object::View v) const;
00674 
00675             // ----- data members ---------------------------------------
00676 
00677             protected:
00678                 /**
00679                 * Wrapped MapListener.
00680                 */
00681                 MemberHandle<MapListener> m_hListener;
00682             };
00683 
00684     // ----- inner class: WrapperPrimingListener ------------------------
00685 
00686     public:
00687         /**
00688          * A wrapper class that turns the specified MapListener into
00689          * a Priminglistener.
00690          *
00691          * @since 12.2.1
00692          */
00693         class COH_EXPORT WrapperPrimingListener
00694             : public class_spec<WrapperPrimingListener,
00695                 extends<WrapperSynchronousListener>,
00696                 implements<PrimingListener> >
00697         {
00698         friend class factory<WrapperPrimingListener>;
00699 
00700         // ----- constructors ---------------------------------------
00701 
00702         protected:
00703             /**
00704              * Create a new WrapperPrimingListener.
00705              *
00706              * @param hListener  the listener to be wrapped
00707              *
00708              * @return the new WrapperPrimingListener instance
00709              */
00710             WrapperPrimingListener(MapListener::Handle hListener);
00711 
00712         private:
00713             /**
00714              * Blocked copy constructor.
00715              */
00716             WrapperPrimingListener(const WrapperPrimingListener&);
00717         };
00718 
00719     // ----- enums ----------------------------------------------------------
00720 
00721     protected:
00722         /**
00723         * Optimization Plan enum.
00724         */
00725         enum Plan
00726             {
00727             none,          // A plan has not yet been formed
00728             no_listeners,  // There are no listeners
00729             all_listener,  // There is one all-keys non-filtered listener
00730             key_listener,  // One key listener (even if for multiple keys)
00731             no_optimize    // No optimized plan, use the default approach
00732             };
00733 
00734 
00735     // ----- data members ---------------------------------------------------
00736 
00737     protected:
00738          /**
00739         * The collections of MapListener objects that have signed up for
00740         * notifications from an ObservableMap implementation keyed by the
00741         * corresponding Filter objects.
00742         */
00743         MemberHandle<Map> m_hmapListeners;
00744 
00745         /**
00746         * The collections of MapListener objects that have signed up for key
00747         * based notifications from an ObservableMap implementation keyed by
00748         * the corresponding key objects.
00749         */
00750         MemberHandle<Map> m_hmapKeyListeners;
00751 
00752         // consider adding listener tag support to Listeners class, which
00753         // would allow getting rid of the following data structures ...
00754         /**
00755         * The subset of standard (not lite) global listeners. The keys are
00756         * the Filter objects, the values are sets of corresponding standard
00757         * listeners.
00758         */
00759         MemberHandle<Map> m_hmapStandardListeners;
00760 
00761         /**
00762         * The subset of standard (not lite) key listeners. The keys are the
00763         * key objects, the values are sets of corresponding standard
00764         * listeners.
00765         */
00766         MemberHandle<Map> m_hmapStandardKeyListeners;
00767 
00768         /**
00769         * The optimization plan which indicates the fastest way to put
00770         * together a set of listeners.
00771         */
00772         Plan m_optimizationPlan;
00773 
00774         /**
00775         * A cached set of Listeners.
00776         */
00777         MemberView<Listeners> m_vListenersCached;
00778     };
00779 
00780 COH_CLOSE_NAMESPACE2
00781 
00782 #endif // COH_MAP_LISTENER_SUPPORT_HPP
00783 
Copyright © 2000, 2019, Oracle and/or its affiliates. All rights reserved.