Package org.acplt.oncrpc
Class OncRpcTcpSocketHelper.Connectiator
- java.lang.Object
-
- java.lang.Thread
-
- org.acplt.oncrpc.OncRpcTcpSocketHelper.Connectiator
-
- All Implemented Interfaces:
java.lang.Runnable
- Enclosing class:
- OncRpcTcpSocketHelper
private class OncRpcTcpSocketHelper.Connectiator extends java.lang.ThreadThe classConnectiatorhas a short and sometimes sad life, as its only purpose is trying to connect to a TCP port at another host machine.
-
-
Field Summary
Fields Modifier and Type Field Description private java.net.InetAddressaddressHost to connect to.private booleanhitTheBucketFlag to indicate that the socket is not needed, as the caller timed out.private java.io.IOExceptionioexceptionIOExceptioncaused by connection attempt, if any, ornull.private intportTCP port to connect to.private java.net.SocketsocketSocket object, if the connection could be established, ornull.
-
Constructor Summary
Constructors Constructor Description Connectiator(java.net.InetAddress address, int port)Construct a newConnectiatorthat can later be used connect to the given TCP port at the host specified.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.IOExceptiongetIOException()Return exception caused by connection operation, if any, ornullif no exception was thrown.java.net.SocketgetSocket()Return socket created by connection establishment, ornullif the connection could not be established.voidnotRequiredAnyMore()Indicates that the caller initiating this Thread is not interested in its results any more.voidrun()-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
address
private java.net.InetAddress address
Host to connect to.
-
port
private int port
TCP port to connect to.
-
ioexception
private java.io.IOException ioexception
IOExceptioncaused by connection attempt, if any, ornull.
-
socket
private java.net.Socket socket
Socket object, if the connection could be established, ornull.
-
hitTheBucket
private boolean hitTheBucket
Flag to indicate that the socket is not needed, as the caller timed out.
-
-
Constructor Detail
-
Connectiator
public Connectiator(java.net.InetAddress address, int port)Construct a newConnectiatorthat can later be used connect to the given TCP port at the host specified. Note that we do not try to establish the connection yet; this has to be done later using therun()method.
-
-
Method Detail
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
getIOException
public java.io.IOException getIOException()
Return exception caused by connection operation, if any, ornullif no exception was thrown.Note that we do not need to synchronize this method as the caller calls us when it is already holding the lock on us.
- Returns:
- Connection operation exception or
null.
-
getSocket
public java.net.Socket getSocket()
Return socket created by connection establishment, ornullif the connection could not be established.Note that we do not need to synchronize this method as the caller calls us when it is already holding the lock on us.
- Returns:
- Socket or
null.
-
notRequiredAnyMore
public void notRequiredAnyMore()
Indicates that the caller initiating this Thread is not interested in its results any more.Note that we do not need to synchronize this method as the caller calls us when it is already holding the lock on us.
-
-