public abstract class AbstractService<S extends ServiceManager> extends java.lang.Object implements Service<S>
Modifier | Constructor and Description |
---|---|
protected |
AbstractService() |
Modifier and Type | Method and Description |
---|---|
protected <T extends Service<S>> |
getService(java.lang.Class<T> type)
Retrieves the first sibling service of the specified
type.
|
protected S |
getServiceManager()
Returns the ServiceManager that was passed to
initialize() during service initialization.
|
void |
initialize(S serviceManager)
Initializes this service by keeping a reference to
the service manager and calling onInitialize().
|
protected abstract void |
onInitialize(S serviceManager)
Called during initialize() for the subclass to perform
implementation specific initialization.
|
void |
start()
Default implementation does nothing.
|
void |
stop()
Default implementation does nothing.
|
void |
terminate(S serviceManager)
Default implementation does nothing.
|
java.lang.String |
toString() |
protected S getServiceManager()
protected <T extends Service<S>> T getService(java.lang.Class<T> type)
public final void initialize(S serviceManager)
initialize
in interface Service<S extends ServiceManager>
protected abstract void onInitialize(S serviceManager)
public void start()
start
in interface Service<S extends ServiceManager>
public void stop()
stop
in interface Service<S extends ServiceManager>
public void terminate(S serviceManager)
terminate
in interface Service<S extends ServiceManager>
public java.lang.String toString()
toString
in class java.lang.Object