Class WrapperService

    • Field Detail

      • m_service

        protected Service m_service
        The (wrapped) Service.
    • Constructor Detail

      • WrapperService

        public WrapperService​(Service service)
        Create a new WrapperService that delegates to the given Service instance.
        Parameters:
        service - the Service to wrap
    • Method Detail

      • getCluster

        public Cluster getCluster()
        Return the Cluster object that this Service is a part of.
        Specified by:
        getCluster in interface Service
        Returns:
        the Cluster object
      • getInfo

        public ServiceInfo getInfo()
        Return the ServiceInfo object for this Service.
        Specified by:
        getInfo in interface Service
        Returns:
        the ServiceInfo object
      • addMemberListener

        public void addMemberListener​(MemberListener listener)
        Add a Member listener.

        MemberListeners will be invoked in the order in which they are registered.

        Specified by:
        addMemberListener in interface Service
        Parameters:
        listener - the MemberListener to add
      • getUserContext

        public Object getUserContext()
        Return the user context object associated with this Service.

        The data type and semantics of this context object are entirely application specific and are opaque to the Service itself.

        Specified by:
        getUserContext in interface Service
        Returns:
        an associated user context object or null if a context has not been set
      • setUserContext

        public void setUserContext​(Object oCtx)
        Associate a user context object with this Service.
        Specified by:
        setUserContext in interface Service
        Parameters:
        oCtx - a user context object
      • getSerializer

        public Serializer getSerializer()
        Return a Serializer used by this Service.
        Specified by:
        getSerializer in interface Service
        Returns:
        the Serializer object
      • addServiceListener

        public void addServiceListener​(ServiceListener listener)
        Register a ServiceListener that will receive events pertaining to the lifecycle of this Service.
        Specified by:
        addServiceListener in interface Service
        Parameters:
        listener - the new ServiceListener to register; if the listener has already been registered, this method has no effect
      • removeServiceListener

        public void removeServiceListener​(ServiceListener listener)
        Unregister a ServiceListener from this ConnectionManager.

        After a ServiceListener is removed, it will no longer receive events pertaining to the lifecycle of this Service.

        Specified by:
        removeServiceListener in interface Service
        Parameters:
        listener - the ServiceListener to deregister; if the listener has not previously been registered, this method has no effect
      • configure

        public void configure​(XmlElement xml)
        Configure the controllable service.

        This method can only be called before the controllable service is started.

        Specified by:
        configure in interface Controllable
        Parameters:
        xml - an XmlElement carrying configuration information specific to the Controllable object
      • start

        public void start()
        Start the controllable service.

        This method should only be called once per the life cycle of the Controllable service. This method has no affect if the service is already running.

        Specified by:
        start in interface Controllable
      • isRunning

        public boolean isRunning()
        Determine whether or not the controllable service is running. This method returns false before a service is started, while the service is starting, while a service is shutting down and after the service has stopped. It only returns true after completing its start processing and before beginning its shutdown processing.
        Specified by:
        isRunning in interface Controllable
        Returns:
        true if the service is running; false otherwise
      • shutdown

        public void shutdown()
        Stop the controllable service. This is a controlled shut-down, and is preferred to the Controllable.stop() method.

        This method should only be called once per the life cycle of the controllable service. Calling this method for a service that has already stopped has no effect.

        Specified by:
        shutdown in interface Controllable
      • stop

        public void stop()
        Hard-stop the controllable service. Use Controllable.shutdown() for normal service termination. Calling this method for a service that has already stopped has no effect.
        Specified by:
        stop in interface Controllable
      • getContextClassLoader

        public ClassLoader getContextClassLoader()
        Retrieve the context ClassLoader for this object. The context ClassLoader is provided by the creator of the object for use by the object when loading classes and resources.
        Specified by:
        getContextClassLoader in interface ClassLoaderAware
        Returns:
        the context ClassLoader for this object
        See Also:
        Thread.getContextClassLoader()
      • setContextClassLoader

        public void setContextClassLoader​(ClassLoader loader)
        Specify the context ClassLoader for this object. The context ClassLoader can be set when the object is created, and allows the creator to provide the appropriate class loader to be used by the object when when loading classes and resources.
        Specified by:
        setContextClassLoader in interface ClassLoaderAware
        Parameters:
        loader - the context ClassLoader for this object
      • setDependencies

        public void setDependencies​(ServiceDependencies deps)
        Configure the Service.

        This method can only be called before the Service is started.

        Specified by:
        setDependencies in interface Service
        Parameters:
        deps - the dependencies object carrying configuration information specific to this Service
      • getResourceRegistry

        public ResourceRegistry getResourceRegistry()
        Retrieves a Service scoped ResourceRegistry. The resource registry is used to:
        • Register resources with the Service and make them accessible to the application code bound to this Service.
        • Dispose of resources when the Service is shut down; see the ResourceRegistry API for details on how to enable cleanup of resources.
        Specified by:
        getResourceRegistry in interface Service
        Returns:
        a Service scoped resource registry
      • isVersionCompatible

        public boolean isVersionCompatible​(int nMajor,
                                           int nMinor,
                                           int nMicro,
                                           int nPatchSet,
                                           int nPatch)
        Description copied from interface: Service
        Check whether the members of this service run a version that is greater than or equal to the specified version.
        Specified by:
        isVersionCompatible in interface Service
        Parameters:
        nMajor - the major version number
        nMinor - the minor version number
        nMicro - the micro version number
        nPatchSet - the patch set version number
        nPatch - the patch version number
        Returns:
        true if the members of the service are all running a version that is greater than or equal to the specified version
      • isVersionCompatible

        public boolean isVersionCompatible​(int nYear,
                                           int nMonth,
                                           int nPatch)
        Description copied from interface: Service
        Check whether the members of this service run a version that is greater than or equal to the specified version.
        Specified by:
        isVersionCompatible in interface Service
        Parameters:
        nYear - the year version number
        nMonth - the month version number
        nPatch - the patch version number
        Returns:
        true if the members of the service are all running a version that is greater than or equal to the specified version
      • isVersionCompatible

        public boolean isVersionCompatible​(int nVersion)
        Description copied from interface: Service
        Check whether the members of this service run a version that is greater than or equal to the specified version.
        Specified by:
        isVersionCompatible in interface Service
        Parameters:
        nVersion - the encoded version to compare
        Returns:
        true if the members of the service are all running a version that is greater than or equal to the specified version
      • isVersionCompatible

        public boolean isVersionCompatible​(IntPredicate predicate)
        Description copied from interface: Service
        Check whether the members of this service run a minimum service version that matches a specified IntPredicate.
        Specified by:
        isVersionCompatible in interface Service
        Parameters:
        predicate - an IntPredicate to apply to the minimum encoded service version
        Returns:
        true if the minimum service version matches the predicate
      • getMinimumServiceVersion

        public int getMinimumServiceVersion()
        Description copied from interface: Service
        Return the minimum version for the members in this set.
        Specified by:
        getMinimumServiceVersion in interface Service
        Returns:
        the minimum version for the members in this set
      • getService

        public Service getService()
        Return the wrapped Service.
        Returns:
        the wrapped Service