java.lang.Object
swim.io.Station
Asynchronous I/O multiplexor.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Stage
Stage on which to execute I/O tasks.protected TransportSettings
Transport configuration parameters. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Lifecycle callback invoked if the selector thread throws a fatalerror
.protected void
didStart()
Lifecycle callback invoked after the selector thread starts.protected void
didStop()
Lifecycle callback invoked after the selector thread stops.final Stage
stage()
Returns theStage
on which thisStation
executes I/O tasks.void
start()
Ensures that thisStation
is up and running, starting up the selector thread if it has not yet been started.void
stop()
Ensures that thisStation
has been permanently stopped, shutting down the selector thread, if it's currently running.transport
(Transport transport, FlowControl flowControl) Binds the giventransport
to thisStation
, initializing thetransport
's context with the givenflowControl
state.protected void
transportDidAccept
(Transport transport) Introspection callback invoked after atransport
completes an accept operation.protected void
transportDidClose
(Transport transport) Introspection callback invoked after atransport
closes.protected void
transportDidConnect
(Transport transport) Introspection callback invoked after atransport
completes a connect operation.protected void
transportDidFail
(Transport transport, Throwable error) Introspection callback invoked after atransport
operation fails by throwing anerror
.protected void
transportDidTimeout
(Transport transport) Introspection callback invoked after atransport
times out.final TransportSettings
Returns the transport configuration parameters that govern thisStation
's regsitered transports.transportSettings
(TransportSettings transportSettings) Updates the transport configuration parameters that govern thisStation
's registered transports, and returnsthis
.protected void
Lifecycle callback invoked before the selector thread starts.protected void
willStop()
Lifecycle callback invoked before the selector thread stops.
-
Field Details
-
stage
Stage on which to execute I/O tasks. -
transportSettings
Transport configuration parameters.
-
-
Constructor Details
-
Station
-
Station
-
-
Method Details
-
stage
Returns theStage
on which thisStation
executes I/O tasks. -
transportSettings
Returns the transport configuration parameters that govern thisStation
's regsitered transports. -
transportSettings
Updates the transport configuration parameters that govern thisStation
's registered transports, and returnsthis
. -
start
public void start()Ensures that thisStation
is up and running, starting up the selector thread if it has not yet been started.- Throws:
StationException
- if thisStation
has been stopped.
-
stop
public void stop()Ensures that thisStation
has been permanently stopped, shutting down the selector thread, if it's currently running. Upon return, thisStation
is guaranteed to be in the stopped state. -
transport
Binds the giventransport
to thisStation
, initializing thetransport
's context with the givenflowControl
state. TheStation
thereafter asynchronously executes I/O tasks on behalf of thetransport
when the underlying physical transport is ready for I/O operations permitted by thetransport
's current flow control state. Returns aTransportRef
, which can be used to modify the flow control of thetransport
, and to close thetransport
. -
willStart
protected void willStart()Lifecycle callback invoked before the selector thread starts. -
didStart
protected void didStart()Lifecycle callback invoked after the selector thread starts. -
willStop
protected void willStop()Lifecycle callback invoked before the selector thread stops. -
didStop
protected void didStop()Lifecycle callback invoked after the selector thread stops. -
didFail
Lifecycle callback invoked if the selector thread throws a fatalerror
. The selector thread will stop after invokingdidFail
. -
transportDidAccept
Introspection callback invoked after atransport
completes an accept operation. -
transportDidConnect
Introspection callback invoked after atransport
completes a connect operation. -
transportDidTimeout
Introspection callback invoked after atransport
times out. -
transportDidClose
Introspection callback invoked after atransport
closes. -
transportDidFail
Introspection callback invoked after atransport
operation fails by throwing anerror
.
-