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
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.IOJobImplLenientis used instead of com.fishlib.io.sched.IOJobImpl when configured to do so
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumthese are the states the connector can be in -
Constructor Summary
ConstructorsConstructorDescriptionConnector(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) Initiate a new connection, delivering only a raw socketConnector(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) Initiate a new connection.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) Initiate a new connection.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) Initiate a new connection. -
Method Summary
Modifier and TypeMethodDescriptioncom.fishlib.base.log.LogOutputappend(com.fishlib.base.log.LogOutput logOutput) voidThis method is called if the job is explicitly cancelled before it becomes ready or times out.intintgetState()intinvoke(SelectableChannel channel, int readyOps, com.fishlib.base.Procedure.Nullary handoff) This method is invoked by the scheduler when the job's channel becomes ready.voidtimedOut()This method is invoked if the job times out.Methods inherited from class io.deephaven.enterprise.comm.sched.Job
getStateFor, makeStateFor
-
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, throws IOExceptionIOException> observer) Initiate a new connection.- Parameters:
addr- the address to which we will connectconnectParameters- the timing and retry parametersioParameters- the IO parameters for the connected sockethandler- the IO handler for the connected socketobserver- 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, throws IOExceptionIOException> observer) Initiate a new connection.- Parameters:
addr- the address for the initial connection, may be nulladdrFun- a function which provides the address to which we will connectconnectParameters- the timing and retry parametersioParameters- the IO parameters for the connected sockethandler- the IO handler for the connected socketobserver- 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, throws IOExceptionIOException> observer) Initiate a new connection.- Parameters:
addr- the address for the initial connection, may be nulladdrFun- a function which provides the address to which we will connectconnectParameters- the timing and retry parametersioParameters- the IO parameters for the connected sockethandler- the IO handler for the connected socketuseLenientIOJob- if true, use the IOJobImplLenient implementation, else IOJobImplobserver- 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, throws IOExceptionIOException> rawObserver) Initiate a new connection, delivering only a raw socket- Parameters:
addr- the address for the initial connection, may be nulladdrFun- a function which provides the address to which we will connectconnectParameters- the timing and retry parametersrawObserver- 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) -
getSocket
-
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:JobThis method is invoked by the scheduler when the job's channel becomes ready.- Specified by:
invokein classJob- Parameters:
channel- the channel which has become readyreadyOps- 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:JobThis method is called if the job is explicitly cancelled before it becomes ready or times out. -
timedOut
public void timedOut()Description copied from class:JobThis method is invoked if the job times out.
-