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 Addressaddrprivate intcurrentReconnectIvlprotected booleandelayedStartprivate java.nio.channels.SocketChannelfdprivate Poller.Handlehandleprotected IOObjectioObjectprotected static intRECONNECT_TIMER_IDprivate SessionBasesessionprivate SocketBasesocketprivate booleantimerStarted
-
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 voidaddReconnectTimer()protected voidclose()private java.nio.channels.SocketChannelconnect()voidconnectEvent()Called by I/O thread when file descriptor might be ready for connecting.protected voiddestroy()private intgetNewReconnectIvl()voidinEvent()Called by I/O thread when file descriptor is ready for reading.private booleanopen()voidoutEvent()Called by I/O thread when file descriptor is ready for writing.protected voidprocessPlug()protected voidprocessTerm(int linger)private voidstartConnecting()voidtimerEvent(int id)Called when timer expires.java.lang.StringtoString()-
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, processCancel, processHiccup, processPipeTerm, processPipeTermAck, processReap, processReapAck, processReaped, processStop, registerEndpoint, sendActivateRead, sendActivateWrite, sendAttach, sendAttach, sendBind, sendBind, sendCancel, sendDone, sendHiccup, sendInprocConnected, sendOwn, sendPipeTerm, sendPipeTermAck, sendPlug, sendPlug, sendReap, sendReapAck, 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:
processPlugin classZObject
-
processTerm
protected void processTerm(int linger)
- Overrides:
processTermin classOwn
-
connectEvent
public void connectEvent()
Description copied from interface:IPollEventsCalled by I/O thread when file descriptor might be ready for connecting.- Specified by:
connectEventin interfaceIPollEvents
-
timerEvent
public void timerEvent(int id)
Description copied from interface:IPollEventsCalled when timer expires.- Specified by:
timerEventin 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:IPollEventsCalled by I/O thread when file descriptor is ready for reading.- Specified by:
inEventin interfaceIPollEvents
-
outEvent
public void outEvent()
Description copied from interface:IPollEventsCalled by I/O thread when file descriptor is ready for writing.- Specified by:
outEventin interfaceIPollEvents
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-