Package zmq.io.net.tcp
Class TcpConnecter
- java.lang.Object
-
- zmq.ZObject
-
- zmq.Own
-
- zmq.io.net.tcp.TcpConnecter
-
- All Implemented Interfaces:
IPollEvents
- Direct Known Subclasses:
IpcConnecter
,SocksConnecter
,TipcConnecter
public class TcpConnecter extends Own implements IPollEvents
-
-
Field Summary
Fields Modifier and Type Field Description private Address
addr
private int
currentReconnectIvl
protected boolean
delayedStart
private java.nio.channels.SocketChannel
fd
private Poller.Handle
handle
protected IOObject
ioObject
protected static int
RECONNECT_TIMER_ID
private SessionBase
session
private SocketBase
socket
private boolean
timerStarted
-
Constructor Summary
Constructors Constructor Description TcpConnecter(IOThread ioThread, SessionBase session, Options options, Address addr, boolean delayedStart)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addReconnectTimer()
protected void
close()
private java.nio.channels.SocketChannel
connect()
void
connectEvent()
Called by I/O thread when file descriptor might be ready for connecting.protected void
destroy()
private int
getNewReconnectIvl()
void
inEvent()
Called by I/O thread when file descriptor is ready for reading.private boolean
open()
void
outEvent()
Called by I/O thread when file descriptor is ready for writing.protected void
processPlug()
protected void
processTerm(int linger)
private void
startConnecting()
void
timerEvent(int id)
Called when timer expires.java.lang.String
toString()
-
Methods inherited from class zmq.Own
incSeqnum, isTerminating, launchChild, processDestroy, processOwn, processSeqnum, processTermAck, processTermReq, termChild, terminate
-
Methods inherited from class zmq.ZObject
chooseIoThread, connectPending, destroySocket, findEndpoint, getCtx, getTid, pendConnection, processActivateRead, processActivateWrite, processAttach, processBind, processHiccup, processPipeTerm, processPipeTermAck, processReap, processReaped, processStop, registerEndpoint, sendActivateRead, sendActivateWrite, sendAttach, sendAttach, sendBind, sendBind, sendDone, sendHiccup, sendInprocConnected, sendOwn, sendPipeTerm, sendPipeTermAck, sendPlug, sendPlug, sendReap, sendReaped, sendStop, sendTerm, sendTermAck, sendTermReq, setTid, unregisterEndpoint, unregisterEndpoints
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface zmq.poll.IPollEvents
acceptEvent
-
-
-
-
Field Detail
-
RECONNECT_TIMER_ID
protected static final int RECONNECT_TIMER_ID
- See Also:
- Constant Field Values
-
ioObject
protected final IOObject ioObject
-
addr
private final Address addr
-
fd
private java.nio.channels.SocketChannel fd
-
handle
private Poller.Handle handle
-
delayedStart
protected final boolean delayedStart
-
timerStarted
private boolean timerStarted
-
session
private final SessionBase session
-
currentReconnectIvl
private int currentReconnectIvl
-
socket
private final SocketBase socket
-
-
Constructor Detail
-
TcpConnecter
public TcpConnecter(IOThread ioThread, SessionBase session, Options options, Address addr, boolean delayedStart)
-
-
Method Detail
-
processPlug
protected void processPlug()
- Overrides:
processPlug
in classZObject
-
processTerm
protected void processTerm(int linger)
- Overrides:
processTerm
in classOwn
-
connectEvent
public void connectEvent()
Description copied from interface:IPollEvents
Called by I/O thread when file descriptor might be ready for connecting.- Specified by:
connectEvent
in interfaceIPollEvents
-
timerEvent
public void timerEvent(int id)
Description copied from interface:IPollEvents
Called when timer expires.- Specified by:
timerEvent
in interfaceIPollEvents
- Parameters:
id
- the ID of the expired timer.
-
startConnecting
private void startConnecting()
-
addReconnectTimer
private void addReconnectTimer()
-
getNewReconnectIvl
private int getNewReconnectIvl()
-
open
private boolean open() throws java.io.IOException
- Throws:
java.io.IOException
-
connect
private java.nio.channels.SocketChannel connect()
-
close
protected void close()
-
inEvent
public void inEvent()
Description copied from interface:IPollEvents
Called by I/O thread when file descriptor is ready for reading.- Specified by:
inEvent
in interfaceIPollEvents
-
outEvent
public void outEvent()
Description copied from interface:IPollEvents
Called by I/O thread when file descriptor is ready for writing.- Specified by:
outEvent
in interfaceIPollEvents
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-