Class ServiceManager<T>

java.lang.Object
com.jme3.network.service.ServiceManager<T>
Direct Known Subclasses:
ClientServiceManager, HostedServiceManager

public abstract class ServiceManager<T> extends Object
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

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <S extends Service<T>>
    void
    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.
    <S extends Service<T>>
    S
    getService(Class<S> type)
    Retrieves the first service of the specified type.
    protected List<Service<T>>
    Returns the complete list of services managed by this service manager.
    boolean
    Returns true if this service manager has been started.
    <S extends Service<T>>
    void
    Removes the specified service from this service manager, stopping and terminating it as required.
    void
    Starts this service manager and all services that it contains.
    void
    Stops all services and puts the service manager into a stopped state.
    void
    Terminates all services.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ServiceManager

      protected ServiceManager()
  • Method Details

    • getParent

      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.
    • getServices

      protected List<Service<T>> 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

      public <S extends Service<T>> void addService(S s)
      Adds the specified service and initializes it. If the service manager has already been started then the service will also be started.
    • removeService

      public <S extends Service<T>> void removeService(S s)
      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

      public <S extends Service<T>> S getService(Class<S> type)
      Retrieves the first service of the specified type.
    • toString

      public String toString()
      Overrides:
      toString in class Object