Module swim.io
Package swim.io

Class Station


  • public class Station
    extends Object
    Asynchronous I/O multiplexor.
    • Field Detail

      • stage

        protected final Stage stage
        Stage on which to execute I/O tasks.
      • transportSettings

        protected TransportSettings transportSettings
        Transport configuration parameters.
    • Method Detail

      • stage

        public final Stage stage()
        Returns the Stage on which this Station executes I/O tasks.
      • transportSettings

        public final TransportSettings transportSettings()
        Returns the transport configuration parameters that govern this Station's regsitered transports.
      • transportSettings

        public Station transportSettings​(TransportSettings transportSettings)
        Updates the transport configuration parameters that govern this Station's registered transports, and returns this.
      • start

        public void start()
        Ensures that this Station is up and running, starting up the selector thread if it has not yet been started.
        Throws:
        StationException - if this Station has been stopped.
      • stop

        public void stop()
        Ensures that this Station has been permanently stopped, shutting down the selector thread, if it's currently running. Upon return, this Station is guaranteed to be in the stopped state.
      • transport

        public TransportRef transport​(Transport transport,
                                      FlowControl flowControl)
        Binds the given transport to this Station, initializing the transport's context with the given flowControl state. The Station thereafter asynchronously executes I/O tasks on behalf of the transport when the underlying physical transport is ready for I/O operations permitted by the transport's current flow control state. Returns a TransportRef, which can be used to modify the flow control of the transport, and to close the transport.
      • 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

        protected void didFail​(Throwable error)
        Lifecycle callback invoked if the selector thread throws a fatal error. The selector thread will stop after invoking didFail.
      • transportDidAccept

        protected void transportDidAccept​(Transport transport)
        Introspection callback invoked after a transport completes an accept operation.
      • transportDidConnect

        protected void transportDidConnect​(Transport transport)
        Introspection callback invoked after a transport completes a connect operation.
      • transportDidTimeout

        protected void transportDidTimeout​(Transport transport)
        Introspection callback invoked after a transport times out.
      • transportDidClose

        protected void transportDidClose​(Transport transport)
        Introspection callback invoked after a transport closes.
      • transportDidFail

        protected void transportDidFail​(Transport transport,
                                        Throwable error)
        Introspection callback invoked after a transport operation fails by throwing an error.