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. -
IOJobImplLenientis used instead ofIOJobImpl
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumthese 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.LogOutputappend(com.fishlib.base.log.LogOutput logOutput) voidintintgetState()intinvoke(SelectableChannel channel, int readyOps, com.fishlib.base.Procedure.Nullary handoff) voidtimedOut()
-
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:
appendin interfacecom.fishlib.base.log.LogOutputAppendable- Overrides:
appendin 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:
invokein classcom.fishlib.io.sched.Job- Throws:
IOException
-
cancelled
public void cancelled()- Specified by:
cancelledin classcom.fishlib.io.sched.Job
-
timedOut
public void timedOut()- Specified by:
timedOutin classcom.fishlib.io.sched.Job
-