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 Summary
ConstructorsModifierConstructorDescriptionprotectedCreates an uninitialized hosted service. -
Method Summary
Modifier and TypeMethodDescriptionvoidconnectionAdded(Server server, HostedConnection hc) Default implementation does nothing.voidconnectionRemoved(Server server, HostedConnection hc) Default implementation does nothing.protected ServerReturns the server for this hosted service or null if the service is not yet attached.Methods inherited from class AbstractService
getService, getServiceManager, initialize, onInitialize, start, stop, terminate, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface HostedService
initialize, start, stop, terminate
-
Constructor Details
-
AbstractHostedService
protected AbstractHostedService()Creates an uninitialized hosted service.
-
-
Method Details
-
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
Default implementation does nothing. Implementations can override this to perform custom new connection behavior.- Specified by:
connectionAddedin interfaceConnectionListener- Parameters:
server- the server that accepted the connectionhc- the newly connected client
-
connectionRemoved
Default implementation does nothing. Implementations can override this to perform custom leaving connection behavior.- Specified by:
connectionRemovedin interfaceConnectionListener- Parameters:
server- the server that removed the connectionhc- the disconnected client
-