- java.lang.Object
-
- swim.io.AbstractService
-
- All Implemented Interfaces:
FlowContext,Service
public abstract class AbstractService extends Object implements Service, FlowContext
-
-
Field Summary
Fields Modifier and Type Field Description protected ServiceContextcontext
-
Constructor Summary
Constructors Constructor Description AbstractService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Modem<?,?>createModem()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.FlowControlflowControl()Returns the currentFlowControlstate of the underlying network channel.voidflowControl(FlowControl flowControl)Enqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl.FlowControlflowControl(FlowModifier flowModifier)Enqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifierdelta.InetSocketAddresslocalAddress()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.SocketSettingssocketSettings()voidunbind()
-
-
-
Field Detail
-
context
protected ServiceContext context
-
-
Method Detail
-
serviceContext
public ServiceContext serviceContext()
Description copied from interface:ServiceReturns the network listener context to which thisServiceis bound; returnsnullif thisServiceis unbound.- Specified by:
serviceContextin interfaceService
-
setServiceContext
public void setServiceContext(ServiceContext context)
Description copied from interface:ServiceSets the network listener context to which thisServiceis bound.- Specified by:
setServiceContextin interfaceService
-
createSocket
public Socket createSocket()
Description copied from interface:ServiceReturns a newSocketbinding to handle an incoming network connection.- Specified by:
createSocketin interfaceService
-
createModem
public Modem<?,?> createModem()
-
didBind
public void didBind()
Description copied from interface:ServiceLifecycle callback invoked by the service context after the underlying network listener has bound to a port.
-
didAccept
public void didAccept(Socket socket)
Description copied from interface:ServiceLifecycle callback invoked by the service context after the underlying network listener has accepted a newsocketconnection.
-
didUnbind
public void didUnbind()
Description copied from interface:ServiceLifecycle callback invoked by the service context after the underlying network listener has been unbound.
-
didFail
public void didFail(Throwable error)
Description copied from interface:ServiceLifecycle callback invoked by the service context when the underlying network listener fails by throwing anerror. The listener will automatically be closed.
-
flowControl
public FlowControl flowControl()
Description copied from interface:FlowContextReturns the currentFlowControlstate of the underlying network channel.- Specified by:
flowControlin interfaceFlowContext
-
flowControl
public void flowControl(FlowControl flowControl)
Description copied from interface:FlowContextEnqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl.- Specified by:
flowControlin interfaceFlowContext
-
flowControl
public FlowControl flowControl(FlowModifier flowModifier)
Description copied from interface:FlowContextEnqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifierdelta.- Specified by:
flowControlin interfaceFlowContext
-
socketSettings
public SocketSettings socketSettings()
-
localAddress
public InetSocketAddress localAddress()
-
unbind
public void unbind()
-
-