Package com.jme3.network.service
Class AbstractService<S extends ServiceManager>
java.lang.Object
com.jme3.network.service.AbstractService<S>
- All Implemented Interfaces:
Service<S>
- Direct Known Subclasses:
AbstractClientService,AbstractHostedService
public abstract class AbstractService<S extends ServiceManager>
extends Object
implements Service<S>
Base class providing some default Service interface implementations
as well as a few convenience methods such as getServiceManager()
and getService(type). Subclasses must at least override the
onInitialize() method to handle service initialization.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetService(Class<T> type) Retrieves the first sibling service of the specified type.protected SReturns the ServiceManager that was passed to initialize() during service initialization.final voidinitialize(S serviceManager) Initializes this service by keeping a reference to the service manager and calling onInitialize().protected abstract voidonInitialize(S serviceManager) Called during initialize() for the subclass to perform implementation specific initialization.voidstart()Default implementation does nothing.voidstop()Default implementation does nothing.voidDefault implementation does nothing.toString()
-
Constructor Details
-
AbstractService
protected AbstractService()
-
-
Method Details
-
getServiceManager
Returns the ServiceManager that was passed to initialize() during service initialization. -
getService
Retrieves the first sibling service of the specified type. -
initialize
Initializes this service by keeping a reference to the service manager and calling onInitialize().- Specified by:
initializein interfaceService<S extends ServiceManager>
-
onInitialize
Called during initialize() for the subclass to perform implementation specific initialization. -
start
public void start()Default implementation does nothing. Implementations can override this to perform custom startup behavior.- Specified by:
startin interfaceService<S extends ServiceManager>
-
stop
public void stop()Default implementation does nothing. Implementations can override this to perform custom stop behavior.- Specified by:
stopin interfaceService<S extends ServiceManager>
-
terminate
Default implementation does nothing. Implementations can override this to perform custom termination behavior.- Specified by:
terminatein interfaceService<S extends ServiceManager>
-
toString
-