Class ServiceManager

  • All Implemented Interfaces:
    Serializable

    public class ServiceManager
    extends Object
    implements Serializable
    Object which manages services. There is only one ServiceManager object per agent server. The ServiceManager object is initialized in init, called from AgentServer.init. This classes reuses the persistency service provided by Transaction.
    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Define serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • logger

        static Logger logger
      • DEBUG

        private static final boolean DEBUG
      • manager

        static ServiceManager manager
        the unique ServiceManager in the agent server
      • name

        private static String name
      • txname

        public static String txname
    • Constructor Detail

      • ServiceManager

        private ServiceManager()
        Default constructor.
    • Method Detail

      • getName

        public static final String getName()
      • init

        static void init()
                  throws Exception
        Initializes the ServiceManager object. Synchronize the persistent image and the configuration file.
        Throws:
        Exception - unspecialized exception
      • save

        static void save()
                  throws IOException
        Saves object in persistent storage.
        Throws:
        IOException - an error occurs.
      • loadServiceClasses

        public static void loadServiceClasses()
                                       throws Exception
        Loads the class of every service.
        Throws:
        Exception - if an error occurs
      • loadServiceClass

        public static void loadServiceClass​(ServiceDesc desc)
                                     throws Exception
        Loads the class of a service.
        Parameters:
        desc - the service descriptor
        Throws:
        Exception - if an error occurs
      • start

        public static void start​(ServiceDesc desc)
                          throws Exception
        Start a Service defined by its descriptor.
        Parameters:
        desc - service descriptor.
        Throws:
        Exception - if an error occurs
      • start

        static void start​(String scname)
                   throws Exception
        Start a Service identified by its name.
        Parameters:
        scname - service class name.
        Throws:
        Exception - if an error occurs
      • start

        static void start​(boolean exitOnFailure)
                   throws Exception
        Starts all defined services.
        Parameters:
        exitOnFailure - if true exit on failure.
        Throws:
        Exception - if an error occurs
      • stop

        public static void stop​(ServiceDesc desc)
                         throws Exception
        Stop a Service defined by its descriptor.
        Parameters:
        desc - service descriptor.
        Throws:
        Exception - if an error occurs
      • stop

        public static void stop​(String scname)
                         throws Exception
        Stop a Service identified by its name.
        Parameters:
        scname - service class name.
        Throws:
        Exception - if an error occurs
      • stop

        static void stop()
        Stops all running services.
      • register

        public static void register​(String scname,
                                    String args)
        Registers a new Service object.
        Parameters:
        scname - service class name.
        args - launching arguments.
      • unregister

        static void unregister​(String scname)
        Unregisters useless Service.
        Parameters:
        scname - service class name.
      • listServices

        static Set<String> listServices()
      • toString

        public String toString()
        Provides a string image for this object.
        Overrides:
        toString in class Object
        Returns:
        a string image for this object