Class Connector
java.lang.Object
com.fishlib.io.sched.Job
com.illumon.iris.db.v2.locations.remote.Connector
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable
public class Connector
extends com.fishlib.io.sched.Job
implements com.fishlib.base.log.LogOutputAppendable
This class is a clone of
Connector
, with the following changes:
-
maybeRetry(IOException)
quits trying when the job has been canceled. -
IOJobImplLenient
is used instead ofIOJobImpl
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
these are the states the connector can be in -
Constructor Summary
ConstructorsConstructorDescriptionConnector
(com.fishlib.io.sched.Scheduler sched, com.fishlib.io.sched.SocketFactory socketFactory, SocketAddress addr, com.fishlib.base.Function.Nullary<SocketAddress> addrFun, com.fishlib.io.sched.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
(com.fishlib.io.sched.Scheduler sched, com.fishlib.io.sched.SocketFactory socketFactory, SocketAddress addr, com.fishlib.base.Function.Nullary<SocketAddress> addrFun, com.fishlib.io.sched.ConnectParameters connectParameters, com.fishlib.io.sched.IOParameters ioParameters, com.fishlib.io.sched.IOStats stats, com.fishlib.io.sched.IOHandler handler, com.fishlib.io.logger.Logger log, boolean useLenientIOJob, com.fishlib.base.Procedure.Ternary<Connector, com.fishlib.io.sched.IOJob, IOException> observer) Initiate a new connection.Connector
(com.fishlib.io.sched.Scheduler sched, com.fishlib.io.sched.SocketFactory socketFactory, SocketAddress addr, com.fishlib.base.Function.Nullary<SocketAddress> addrFun, com.fishlib.io.sched.ConnectParameters connectParameters, com.fishlib.io.sched.IOParameters ioParameters, com.fishlib.io.sched.IOStats stats, com.fishlib.io.sched.IOHandler handler, com.fishlib.io.logger.Logger log, com.fishlib.base.Procedure.Ternary<Connector, com.fishlib.io.sched.IOJob, IOException> observer) Initiate a new connection.Connector
(com.fishlib.io.sched.Scheduler sched, com.fishlib.io.sched.SocketFactory socketFactory, SocketAddress addr, com.fishlib.io.sched.ConnectParameters connectParameters, com.fishlib.io.sched.IOParameters ioParameters, com.fishlib.io.sched.IOStats stats, com.fishlib.io.sched.IOHandler handler, com.fishlib.io.logger.Logger log, com.fishlib.base.Procedure.Ternary<Connector, com.fishlib.io.sched.IOJob, IOException> observer) Initiate a new connection. -
Method Summary
Modifier and TypeMethodDescriptioncom.fishlib.base.log.LogOutput
append
(com.fishlib.base.log.LogOutput logOutput) void
int
int
getState()
int
invoke
(SelectableChannel channel, int readyOps, com.fishlib.base.Procedure.Nullary handoff) void
timedOut()
-
Constructor Details
-
Connector
public Connector(com.fishlib.io.sched.Scheduler sched, com.fishlib.io.sched.SocketFactory socketFactory, SocketAddress addr, com.fishlib.io.sched.ConnectParameters connectParameters, com.fishlib.io.sched.IOParameters ioParameters, com.fishlib.io.sched.IOStats stats, com.fishlib.io.sched.IOHandler handler, com.fishlib.io.logger.Logger log, com.fishlib.base.Procedure.Ternary<Connector, com.fishlib.io.sched.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(com.fishlib.io.sched.Scheduler sched, com.fishlib.io.sched.SocketFactory socketFactory, SocketAddress addr, com.fishlib.base.Function.Nullary<SocketAddress> addrFun, com.fishlib.io.sched.ConnectParameters connectParameters, com.fishlib.io.sched.IOParameters ioParameters, com.fishlib.io.sched.IOStats stats, com.fishlib.io.sched.IOHandler handler, com.fishlib.io.logger.Logger log, com.fishlib.base.Procedure.Ternary<Connector, com.fishlib.io.sched.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(com.fishlib.io.sched.Scheduler sched, com.fishlib.io.sched.SocketFactory socketFactory, SocketAddress addr, com.fishlib.base.Function.Nullary<SocketAddress> addrFun, com.fishlib.io.sched.ConnectParameters connectParameters, com.fishlib.io.sched.IOParameters ioParameters, com.fishlib.io.sched.IOStats stats, com.fishlib.io.sched.IOHandler handler, com.fishlib.io.logger.Logger log, boolean useLenientIOJob, com.fishlib.base.Procedure.Ternary<Connector, com.fishlib.io.sched.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(com.fishlib.io.sched.Scheduler sched, com.fishlib.io.sched.SocketFactory socketFactory, SocketAddress addr, com.fishlib.base.Function.Nullary<SocketAddress> addrFun, com.fishlib.io.sched.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) - Specified by:
append
in interfacecom.fishlib.base.log.LogOutputAppendable
- Overrides:
append
in classcom.fishlib.io.sched.Job
-
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 - Specified by:
invoke
in classcom.fishlib.io.sched.Job
- Throws:
IOException
-
cancelled
public void cancelled()- Specified by:
cancelled
in classcom.fishlib.io.sched.Job
-
timedOut
public void timedOut()- Specified by:
timedOut
in classcom.fishlib.io.sched.Job
-