- java.lang.Object
-
- swim.io.AbstractIpService
-
- All Implemented Interfaces:
FlowContext
,IpService
public abstract class AbstractIpService extends Object implements IpService, FlowContext
-
-
Field Summary
Fields Modifier and Type Field Description protected IpServiceContext
context
-
Constructor Summary
Constructors Constructor Description AbstractIpService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IpModem<?,?>
createModem()
IpSocket
createSocket()
Returns a newIpSocket
binding to handle an incoming network connection.void
didAccept(IpSocket socket)
Lifecycle callback invoked by the service context after the underlying network listener has accepted a newsocket
connection.void
didBind()
Lifecycle callback invoked by the service context after the underlying network listener has bound to a port.void
didFail(Throwable error)
Lifecycle callback invoked by the service context when the underlying network listener fails by throwing anerror
.void
didUnbind()
Lifecycle callback invoked by the service context after the underlying network listener has been unbound.FlowControl
flowControl()
Returns the currentFlowControl
state of the underlying network channel.void
flowControl(FlowControl flowControl)
Enqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl
.FlowControl
flowControl(FlowModifier flowModifier)
Enqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifier
delta.IpServiceContext
ipServiceContext()
Returns the network listener context to which thisIpService
is bound; returnsnull
if thisIpService
is unbound.IpSettings
ipSettings()
InetSocketAddress
localAddress()
void
setIpServiceContext(IpServiceContext context)
Sets the network listener context to which thisIpService
is bound.void
unbind()
-
-
-
Field Detail
-
context
protected IpServiceContext context
-
-
Method Detail
-
ipServiceContext
public IpServiceContext ipServiceContext()
Description copied from interface:IpService
Returns the network listener context to which thisIpService
is bound; returnsnull
if thisIpService
is unbound.- Specified by:
ipServiceContext
in interfaceIpService
-
setIpServiceContext
public void setIpServiceContext(IpServiceContext context)
Description copied from interface:IpService
Sets the network listener context to which thisIpService
is bound.- Specified by:
setIpServiceContext
in interfaceIpService
-
createSocket
public IpSocket createSocket()
Description copied from interface:IpService
Returns a newIpSocket
binding to handle an incoming network connection.- Specified by:
createSocket
in interfaceIpService
-
createModem
public IpModem<?,?> createModem()
-
didBind
public void didBind()
Description copied from interface:IpService
Lifecycle callback invoked by the service context after the underlying network listener has bound to a port.
-
didAccept
public void didAccept(IpSocket socket)
Description copied from interface:IpService
Lifecycle callback invoked by the service context after the underlying network listener has accepted a newsocket
connection.
-
didUnbind
public void didUnbind()
Description copied from interface:IpService
Lifecycle callback invoked by the service context after the underlying network listener has been unbound.
-
didFail
public void didFail(Throwable error)
Description copied from interface:IpService
Lifecycle 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:FlowContext
Returns the currentFlowControl
state of the underlying network channel.- Specified by:
flowControl
in interfaceFlowContext
-
flowControl
public void flowControl(FlowControl flowControl)
Description copied from interface:FlowContext
Enqueues an atomic replacement of the underlying network channel's flow control state with a newflowControl
.- Specified by:
flowControl
in interfaceFlowContext
-
flowControl
public FlowControl flowControl(FlowModifier flowModifier)
Description copied from interface:FlowContext
Enqueues an atomic modification to the underlying network channel's flow control state by applying aflowModifier
delta.- Specified by:
flowControl
in interfaceFlowContext
-
ipSettings
public IpSettings ipSettings()
-
localAddress
public InetSocketAddress localAddress()
-
unbind
public void unbind()
-
-