00001 /* 00002 * Service.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_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 * 00054 * @param hListener the {@link MemberListener} to add 00055 */ 00056 virtual void addMemberListener(MemberListener::Handle hListener) = 0; 00057 00058 /** 00059 * Remove a Member listener. 00060 * 00061 * @param hListener the {@link MemberListener} to remove 00062 */ 00063 virtual void removeMemberListener(MemberListener::Handle hListener) = 0; 00064 00065 /** 00066 * Return the user context object associated with this Service. 00067 * 00068 * The data type and semantics of this context object are entirely 00069 * application specific and are opaque to the Service itself. 00070 * 00071 * @return an associated user context object or NULL if a context 00072 * has not been set 00073 */ 00074 virtual Object::Holder getUserContext() const = 0; 00075 00076 /** 00077 * Associate a user context object with this Service. 00078 * 00079 * @param ohCtx a user context object 00080 */ 00081 virtual void setUserContext(Object::Holder ohCtx) = 0; 00082 00083 /** 00084 * Return a Serializer used by this Service. 00085 * 00086 * @return the Serializer object 00087 * 00088 * @since Coherence 3.4 00089 */ 00090 virtual Serializer::View getSerializer() const = 0; 00091 00092 /** 00093 * Specifies the ThreadGroup within which the Service thread will be 00094 * created. If not specified, the current Thread's ThreadGroup will be 00095 * used. 00096 * 00097 * This property can only be set at runtime, and must be configured 00098 * before start() is invoked to cause the Service thread to be created 00099 * within the specified ThreadGroup. 00100 * 00101 * @param hGroup the group to use 00102 */ 00103 virtual void setThreadGroup(ThreadGroup::Handle hGroup) = 0; 00104 00105 /** 00106 * Return the ThreadGroup for the Daemon. 00107 * 00108 * @return the ThreadGroup for the Daemon. 00109 */ 00110 virtual ThreadGroup::Handle getThreadGroup() = 0; 00111 00112 /** 00113 * Return the ThreadGroup for the Daemon. 00114 * 00115 * @return the ThreadGroup for the Daemon. 00116 */ 00117 virtual ThreadGroup::View getThreadGroup() const = 0; 00118 }; 00119 00120 COH_CLOSE_NAMESPACE2 00121 00122 #endif // COH_NET_SERVICE_HPP