Class Connector

java.lang.Object
io.deephaven.enterprise.comm.sched.Job
io.deephaven.enterprise.niowrapper.sched.Connector
All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable

public class Connector extends Job implements com.fishlib.base.log.LogOutputAppendable
This class is modified from the original fork from com.fishlib.io.sched.Connector, with the following changes:
  • maybeRetry(IOException) quits trying when the job has been canceled.
  • IOJobImplLenient is used instead of com.fishlib.io.sched.IOJobImpl when configured to do so
Fishlib: "This class creates a new IOJob by connecting to a specific SocketAddress."
  • Constructor Details

    • Connector

      public Connector(Scheduler sched, SocketFactory socketFactory, SocketAddress addr, ConnectParameters connectParameters, IOParameters ioParameters, IOStats stats, IOHandler handler, com.fishlib.io.logger.Logger log, com.fishlib.base.Procedure.Ternary<Connector,IOJob,IOException> observer) throws IOException
      Initiate a new connection.
      Parameters:
      addr - the address to which we will connect
      connectParameters - the timing and retry parameters
      ioParameters - the IO parameters for the connected socket
      handler - the IO handler for the connected socket
      observer - called when the connection is established or fails
      Throws:
      IOException
    • Connector

      public Connector(Scheduler sched, SocketFactory socketFactory, SocketAddress addr, com.fishlib.base.Function.Nullary<SocketAddress> addrFun, ConnectParameters connectParameters, IOParameters ioParameters, IOStats stats, IOHandler handler, com.fishlib.io.logger.Logger log, com.fishlib.base.Procedure.Ternary<Connector,IOJob,IOException> observer) throws IOException
      Initiate a new connection.
      Parameters:
      addr - the address for the initial connection, may be null
      addrFun - a function which provides the address to which we will connect
      connectParameters - the timing and retry parameters
      ioParameters - the IO parameters for the connected socket
      handler - the IO handler for the connected socket
      observer - called when the connection is established or fails
      Throws:
      IOException
    • Connector

      public Connector(Scheduler sched, SocketFactory socketFactory, SocketAddress addr, com.fishlib.base.Function.Nullary<SocketAddress> addrFun, ConnectParameters connectParameters, IOParameters ioParameters, IOStats stats, IOHandler handler, com.fishlib.io.logger.Logger log, boolean useLenientIOJob, com.fishlib.base.Procedure.Ternary<Connector,IOJob,IOException> observer) throws IOException
      Initiate a new connection.
      Parameters:
      addr - the address for the initial connection, may be null
      addrFun - a function which provides the address to which we will connect
      connectParameters - the timing and retry parameters
      ioParameters - the IO parameters for the connected socket
      handler - the IO handler for the connected socket
      useLenientIOJob - if true, use the IOJobImplLenient implementation, else IOJobImpl
      observer - called when the connection is established or fails
      Throws:
      IOException
    • Connector

      public Connector(Scheduler sched, SocketFactory socketFactory, SocketAddress addr, com.fishlib.base.Function.Nullary<SocketAddress> addrFun, ConnectParameters connectParameters, com.fishlib.io.logger.Logger log, com.fishlib.base.Procedure.Ternary<Connector,SocketChannel,IOException> rawObserver) throws IOException
      Initiate a new connection, delivering only a raw socket
      Parameters:
      addr - the address for the initial connection, may be null
      addrFun - a function which provides the address to which we will connect
      connectParameters - the timing and retry parameters
      rawObserver - called when the connection is established or fails
      Throws:
      IOException
  • Method Details

    • append

      public com.fishlib.base.log.LogOutput append(com.fishlib.base.log.LogOutput logOutput)
      Specified by:
      append in interface com.fishlib.base.log.LogOutputAppendable
      Overrides:
      append in class Job
    • getSocket

      public SocketChannel getSocket()
    • getState

      public Connector.State getState()
    • getConnectFailures

      public int getConnectFailures()
    • getDroppedConnections

      public int getDroppedConnections()
    • invoke

      public int invoke(SelectableChannel channel, int readyOps, com.fishlib.base.Procedure.Nullary handoff) throws IOException
      Description copied from class: Job
      This method is invoked by the scheduler when the job's channel becomes ready.
      Specified by:
      invoke in class Job
      Parameters:
      channel - the channel which has become ready
      readyOps - the operations which can be performed on this channel without blocking
      Returns:
      the modified readyOps after the invocation; if non-zero, the job will be invoked again with these
      Throws:
      IOException - - if something bad happens
    • cancelled

      public void cancelled()
      Description copied from class: Job
      This method is called if the job is explicitly cancelled before it becomes ready or times out.
      Specified by:
      cancelled in class Job
    • timedOut

      public void timedOut()
      Description copied from class: Job
      This method is invoked if the job times out.
      Specified by:
      timedOut in class Job