public abstract class ServiceManager<T>
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
ServiceManager() |
Modifier and Type | Method and Description |
---|---|
<S extends Service<T>> |
addService(S s)
Adds the specified service and initializes it.
|
protected abstract T |
getParent()
Retrieves the 'parent' of this service manager, usually
a more specifically typed version of 'this' but it can be
anything the services are expecting.
|
<S extends Service<T>> |
getService(java.lang.Class<S> type)
Retrieves the first service of the specified type.
|
protected java.util.List<Service<T>> |
getServices()
Returns the complete list of services managed by this
service manager.
|
boolean |
isStarted()
Returns true if this service manager has been started.
|
<S extends Service<T>> |
removeService(S s)
Removes the specified service from this service manager, stopping
and terminating it as required.
|
void |
start()
Starts this service manager and all services that it contains.
|
void |
stop()
Stops all services and puts the service manager into a stopped state.
|
void |
terminate()
Terminates all services.
|
java.lang.String |
toString() |
protected abstract T getParent()
protected java.util.List<Service<T>> getServices()
public void start()
public boolean isStarted()
public void stop()
public <S extends Service<T>> void addService(S s)
public <S extends Service<T>> void removeService(S s)
public void terminate()
public <S extends Service<T>> S getService(java.lang.Class<S> type)
public java.lang.String toString()
toString
in class java.lang.Object