- java.lang.Object
-
- swim.io.mqtt.MqttSocketService
-
- All Implemented Interfaces:
FlowContext
,IpService
,MqttServiceContext
public class MqttSocketService extends Object implements IpService, MqttServiceContext
-
-
Field Summary
Fields Modifier and Type Field Description protected IpServiceContext
context
protected MqttSettings
mqttSettings
protected MqttService
service
-
Constructor Summary
Constructors Constructor Description MqttSocketService(MqttService service, MqttSettings mqttSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.InetSocketAddress
localAddress()
MqttSettings
mqttSettings()
void
setIpServiceContext(IpServiceContext context)
Sets the network listener context to which thisIpService
is bound.void
unbind()
-
-
-
Field Detail
-
service
protected final MqttService service
-
mqttSettings
protected final MqttSettings mqttSettings
-
context
protected IpServiceContext context
-
-
Constructor Detail
-
MqttSocketService
public MqttSocketService(MqttService service, MqttSettings mqttSettings)
-
-
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
-
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
-
mqttSettings
public MqttSettings mqttSettings()
- Specified by:
mqttSettings
in interfaceMqttServiceContext
-
localAddress
public InetSocketAddress localAddress()
- Specified by:
localAddress
in interfaceMqttServiceContext
-
unbind
public void unbind()
- Specified by:
unbind
in interfaceMqttServiceContext
-
-