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.Thread
The classConnectiator
has 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.InetAddress
address
Host to connect to.private boolean
hitTheBucket
Flag to indicate that the socket is not needed, as the caller timed out.private java.io.IOException
ioexception
IOException
caused by connection attempt, if any, ornull
.private int
port
TCP port to connect to.private java.net.Socket
socket
Socket object, if the connection could be established, ornull
.
-
Constructor Summary
Constructors Constructor Description Connectiator(java.net.InetAddress address, int port)
Construct a newConnectiator
that 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.IOException
getIOException()
Return exception caused by connection operation, if any, ornull
if no exception was thrown.java.net.Socket
getSocket()
Return socket created by connection establishment, ornull
if the connection could not be established.void
notRequiredAnyMore()
Indicates that the caller initiating this Thread is not interested in its results any more.void
run()
-
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
IOException
caused 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 newConnectiator
that 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:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
getIOException
public java.io.IOException getIOException()
Return exception caused by connection operation, if any, ornull
if 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, ornull
if 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.
-
-