Module swim.io
Package swim.io

Class Station

java.lang.Object
swim.io.Station

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

    Fields
    Modifier and Type
    Field
    Description
    protected final Stage
    Stage on which to execute I/O tasks.
    Transport configuration parameters.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Station(Stage stage)
     
    Station(Stage stage, TransportSettings transportSettings)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Lifecycle callback invoked if the selector thread throws a fatal error.
    protected void
    Lifecycle callback invoked after the selector thread starts.
    protected void
    Lifecycle callback invoked after the selector thread stops.
    final Stage
    Returns the Stage on which this Station executes I/O tasks.
    void
    Ensures that this Station is up and running, starting up the selector thread if it has not yet been started.
    void
    Ensures that this Station has been permanently stopped, shutting down the selector thread, if it's currently running.
    transport(Transport transport, FlowControl flowControl)
    Binds the given transport to this Station, initializing the transport's context with the given flowControl state.
    protected void
    Introspection callback invoked after a transport completes an accept operation.
    protected void
    Introspection callback invoked after a transport closes.
    protected void
    Introspection callback invoked after a transport completes a connect operation.
    protected void
    Introspection callback invoked after a transport operation fails by throwing an error.
    protected void
    Introspection callback invoked after a transport times out.
    Returns the transport configuration parameters that govern this Station's regsitered transports.
    Updates the transport configuration parameters that govern this Station's registered transports, and returns this.
    protected void
    Lifecycle callback invoked before the selector thread starts.
    protected void
    Lifecycle callback invoked before the selector thread stops.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • stage

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

      protected TransportSettings transportSettings
      Transport configuration parameters.
  • Constructor Details

  • Method Details

    • 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.