Class AbstractHostedService

java.lang.Object
com.jme3.network.service.AbstractService<HostedServiceManager>
com.jme3.network.service.AbstractHostedService
All Implemented Interfaces:
ConnectionListener, HostedService, Service<HostedServiceManager>
Direct Known Subclasses:
AbstractHostedConnectionService, RmiHostedService, ServerSerializerRegistrationsService

public abstract class AbstractHostedService extends AbstractService<HostedServiceManager> implements HostedService
Convenient base class for HostedServices providing some default HostedService 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.
Author:
Paul Speed
  • Constructor Details

    • AbstractHostedService

      protected AbstractHostedService()
      Creates an uninitialized hosted service.
  • Method Details

    • getServer

      protected Server getServer()
      Returns the server for this hosted service or null if the service is not yet attached.
      Returns:
      the attached server, or null if the service is detached
    • connectionAdded

      public void connectionAdded(Server server, HostedConnection hc)
      Default implementation does nothing. Implementations can override this to perform custom new connection behavior.
      Specified by:
      connectionAdded in interface ConnectionListener
      Parameters:
      server - the server that accepted the connection
      hc - the newly connected client
    • connectionRemoved

      public void connectionRemoved(Server server, HostedConnection hc)
      Default implementation does nothing. Implementations can override this to perform custom leaving connection behavior.
      Specified by:
      connectionRemoved in interface ConnectionListener
      Parameters:
      server - the server that removed the connection
      hc - the disconnected client