-
- All Known Implementing Classes:
AbstractService
public interface ServiceNetwork service listener that handles asynchronous I/O operations for a non-blocking NIO server socket channel. AServiceinterfaces with the underlying asynchronous networking system via aServiceContext. The service context invokes I/O callbacks on theServicewhen the underlying server socket is ready to perform I/O operations permitted by the service context'sFlowControl.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SocketcreateSocket()Returns a newSocketbinding to handle an incoming network connection.voiddidAccept(Socket socket)Lifecycle callback invoked by the service context after the underlying network listener has accepted a newsocketconnection.voiddidBind()Lifecycle callback invoked by the service context after the underlying network listener has bound to a port.voiddidFail(Throwable error)Lifecycle callback invoked by the service context when the underlying network listener fails by throwing anerror.voiddidUnbind()Lifecycle callback invoked by the service context after the underlying network listener has been unbound.ServiceContextserviceContext()Returns the network listener context to which thisServiceis bound; returnsnullif thisServiceis unbound.voidsetServiceContext(ServiceContext context)Sets the network listener context to which thisServiceis bound.
-
-
-
Method Detail
-
serviceContext
ServiceContext serviceContext()
Returns the network listener context to which thisServiceis bound; returnsnullif thisServiceis unbound.
-
setServiceContext
void setServiceContext(ServiceContext context)
Sets the network listener context to which thisServiceis bound.
-
createSocket
Socket createSocket()
Returns a newSocketbinding to handle an incoming network connection.
-
didBind
void didBind()
Lifecycle callback invoked by the service context after the underlying network listener has bound to a port.
-
didAccept
void didAccept(Socket socket)
Lifecycle callback invoked by the service context after the underlying network listener has accepted a newsocketconnection.
-
didUnbind
void didUnbind()
Lifecycle callback invoked by the service context after the underlying network listener has been unbound.
-
didFail
void didFail(Throwable error)
Lifecycle callback invoked by the service context when the underlying network listener fails by throwing anerror. The listener will automatically be closed.
-
-