00001 /* 00002 * MemberListener.hpp 00003 * 00004 * Copyright (c) 2000, 2011, 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_MEMBER_LISTENER_HPP 00017 #define COH_MEMBER_LISTENER_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/net/MemberEvent.hpp" 00022 #include "coherence/util/EventListener.hpp" 00023 00024 COH_OPEN_NAMESPACE2(coherence,net) 00025 00026 using coherence::util::EventListener; 00027 00028 00029 /** 00030 * The listener interface for receiving MemberEvents. 00031 * 00032 * @author jh 2007.12.20 00033 * 00034 * @see MemberEvent 00035 * @see Service 00036 */ 00037 class COH_EXPORT MemberListener 00038 : public interface_spec<MemberListener, 00039 implements<EventListener> > 00040 { 00041 // ----- MemberListener interface --------------------------------------- 00042 00043 public: 00044 /** 00045 * Invoked when a Member has joined the service. 00046 * 00047 * Note: this event could be called during the service restart on the 00048 * local node ({@link MemberEvent#isLocal() evt.isLocal()}) in which 00049 * case the listener's code should not attempt to use any clustered 00050 * cache or service functionality. 00051 * 00052 * The most critical situation arises when a number of threads are 00053 * waiting for a local service restart, being blocked by a Service 00054 * object synchronization monitor. Since the Joined event should be 00055 * fired only once, it is called on an event dispatcher thread 00056 * <b>while holding a synchronization monitor</b>. An attempt to use 00057 * other clustered service functionality during this local event 00058 * notification may result in a deadlock. 00059 * 00060 * @param vEvt the MemberEvent::member_joined event 00061 */ 00062 virtual void memberJoined(MemberEvent::View vEvt) = 0; 00063 00064 /** 00065 * Invoked when a Member is leaving the service. 00066 * 00067 * @param vEvt the MemberEvent::member_leaving event 00068 */ 00069 virtual void memberLeaving(MemberEvent::View vEvt) = 0; 00070 00071 /** 00072 * Invoked when a Member has left the service. 00073 * 00074 * Note: this event could be called during the service restart on the 00075 * local node ({@link MemberEvent#isLocal() evt.isLocal()}) in which 00076 * case the listener's code should not attempt to use any clustered 00077 * cache or service functionality. 00078 * 00079 * @param vEvt the MemberEvent::member_joined event 00080 */ 00081 virtual void memberLeft(MemberEvent::View vEvt) = 0; 00082 }; 00083 00084 COH_CLOSE_NAMESPACE2 00085 00086 #endif // COH_MEMBER_LISTENER_HPP