Package com.jme3.network.service
Class ServiceManager<T>
java.lang.Object
com.jme3.network.service.ServiceManager<T>
- Direct Known Subclasses:
ClientServiceManager
,HostedServiceManager
The base service manager class from which the HostedServiceManager
and ClientServiceManager classes are derived. This manages
the underlying services and their life cycles.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddService
(S s) Adds the specified service and initializes it.protected abstract T
Retrieves the 'parent' of this service manager, usually a more specifically typed version of 'this' but it can be anything the services are expecting.getService
(Class<S> type) Retrieves the first service of the specified type.Returns the complete list of services managed by this service manager.boolean
Returns true if this service manager has been started.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
Terminates all services.toString()
-
Constructor Details
-
ServiceManager
protected ServiceManager()
-
-
Method Details
-
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. -
getServices
Returns the complete list of services managed by this service manager. This list is thread safe following the CopyOnWriteArrayList semantics. -
start
public void start()Starts this service manager and all services that it contains. Any services added after the service manager has started will have their start() methods called. -
isStarted
public boolean isStarted()Returns true if this service manager has been started. -
stop
public void stop()Stops all services and puts the service manager into a stopped state. -
addService
Adds the specified service and initializes it. If the service manager has already been started then the service will also be started. -
removeService
Removes the specified service from this service manager, stopping and terminating it as required. If this service manager is in a started state then the service will be stopped. After removal, the service will be terminated. -
terminate
public void terminate()Terminates all services. If the service manager has not been stopped yet, then it will be stopped. -
getService
Retrieves the first service of the specified type. -
toString
-