com.wutka.util
Interface Service


public interface Service

Interface implemented by services that can be started automatically by the ServiceStarter class.

Since the name of the service is passed in the startService method, it is a good idea to have your services look for their configuration based on the service name. That way, you can have multiple instances of the same service class with different configuration items.

For example, you might have a startService method that fetches configuration like this:

	String myInfo = Config.getConfigItem(serviceName+".myInfo");
 

In your config file, you can list the config items like this:

 instance1.myInfo=Foo
 instance2.myInfo=Bar
 

Then, your service startup file could list the service like this:

 instance1 mypackage.MyServiceClass
 instance2 mypackage.MyServiceClass
 


Method Summary
 void startService(java.lang.String serviceName)
          Asks the service to start itself using the specified service name
 void stopService()
          Asks the service to stop itself
 

Method Detail

startService

public void startService(java.lang.String serviceName)
                  throws ServiceStartupException
Asks the service to start itself using the specified service name

stopService

public void stopService()
Asks the service to stop itself