Class HostedServiceManager


public class HostedServiceManager extends ServiceManager<HostedServiceManager>
Manages HostedServices on behalf of a network Server object. All HostedServices are automatically informed about new and leaving connections.
  • Constructor Details

    • HostedServiceManager

      public HostedServiceManager(Server server)
      Creates a HostedServiceManager for the specified network Server.
  • Method Details

    • getServer

      public Server getServer()
      Returns the network Server associated with this HostedServiceManager.
    • getParent

      protected final HostedServiceManager getParent()
      Returns 'this' and is what is passed to HostedService.initialize() and HostedService.terminate();
      Specified by:
      getParent in class ServiceManager<HostedServiceManager>
    • addService

      public void addService(HostedService s)
      Adds the specified HostedService and initializes it. If the service manager has already been started then the service will also be started.
    • addServices

      public void addServices(HostedService... services)
      Adds the specified services and initializes them. If the service manager has already been started then the services will also be started. This is a convenience method that delegates to addService(), thus each service will be initialized (and possibly started) in sequence rather than doing them all at the end.
    • removeService

      public void removeService(HostedService s)
      Removes the specified HostedService 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.
    • addConnection

      protected void addConnection(HostedConnection hc)
      Called internally when a new connection has been added so that the services can be notified.
    • removeConnection

      protected void removeConnection(HostedConnection hc)
      Called internally when a connection has been removed so that the services can be notified.