00001 /* 00002 * Service.hpp 00003 * 00004 * Copyright (c) 2000, 2016, 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_NET_SERVICE_HPP 00017 #define COH_NET_SERVICE_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/io/Serializer.hpp" 00022 #include "coherence/net/MemberListener.hpp" 00023 #include "coherence/net/ServiceInfo.hpp" 00024 #include "coherence/util/Service.hpp" 00025 00026 COH_OPEN_NAMESPACE2(coherence,net) 00027 00028 using coherence::io::Serializer; 00029 00030 00031 /** 00032 * This Service interface represents a controllable service that operates in a 00033 * clustered network environment. 00034 * 00035 * @author jh 2007.12.20 00036 */ 00037 class COH_EXPORT Service 00038 : public interface_spec<Service, 00039 implements<coherence::util::Service> > 00040 { 00041 // ----- Service interface ---------------------------------------------- 00042 00043 public: 00044 /** 00045 * Return the ServiceInfo object for this Service. 00046 * 00047 * @return the ServiceInfo object 00048 */ 00049 virtual ServiceInfo::View getInfo() const = 0; 00050 00051 /** 00052 * Add a Member listener. 00053 * <p/> 00054 * MemberListeners will be invoked in the order in which they are registered. 00055 * 00056 * @param hListener the {@link MemberListener} to add 00057 */ 00058 virtual void addMemberListener(MemberListener::Handle hListener) = 0; 00059 00060 /** 00061 * Remove a Member listener. 00062 * 00063 * @param hListener the {@link MemberListener} to remove 00064 */ 00065 virtual void removeMemberListener(MemberListener::Handle hListener) = 0; 00066 00067 /** 00068 * Return the user context object associated with this Service. 00069 * 00070 * The data type and semantics of this context object are entirely 00071 * application specific and are opaque to the Service itself. 00072 * 00073 * @return an associated user context object or NULL if a context 00074 * has not been set 00075 */ 00076 virtual Object::Holder getUserContext() const = 0; 00077 00078 /** 00079 * Associate a user context object with this Service. 00080 * 00081 * @param ohCtx a user context object 00082 */ 00083 virtual void setUserContext(Object::Holder ohCtx) = 0; 00084 00085 /** 00086 * Return a Serializer used by this Service. 00087 * 00088 * @return the Serializer object 00089 * 00090 * @since Coherence 3.4 00091 */ 00092 virtual Serializer::View getSerializer() const = 0; 00093 00094 /** 00095 * Specifies the ThreadGroup within which the Service thread will be 00096 * created. If not specified, the current Thread's ThreadGroup will be 00097 * used. 00098 * 00099 * This property can only be set at runtime, and must be configured 00100 * before start() is invoked to cause the Service thread to be created 00101 * within the specified ThreadGroup. 00102 * 00103 * @param hGroup the group to use 00104 */ 00105 virtual void setThreadGroup(ThreadGroup::Handle hGroup) = 0; 00106 00107 /** 00108 * Return the ThreadGroup for the Daemon. 00109 * 00110 * @return the ThreadGroup for the Daemon. 00111 */ 00112 virtual ThreadGroup::Handle getThreadGroup() = 0; 00113 00114 /** 00115 * Return the ThreadGroup for the Daemon. 00116 * 00117 * @return the ThreadGroup for the Daemon. 00118 */ 00119 virtual ThreadGroup::View getThreadGroup() const = 0; 00120 }; 00121 00122 COH_CLOSE_NAMESPACE2 00123 00124 #endif // COH_NET_SERVICE_HPP