Package org.acplt.oncrpc
Class OncRpcTcpSocketHelper.Connectiator
java.lang.Object
java.lang.Thread
org.acplt.oncrpc.OncRpcTcpSocketHelper.Connectiator
- All Implemented Interfaces:
Runnable
- Enclosing class:
- OncRpcTcpSocketHelper
The class
Connectiator
has a short and sometimes sad
life, as its only purpose is trying to connect to a TCP port at
another host machine.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate InetAddress
Host to connect to.private boolean
Flag to indicate that the socket is not needed, as the caller timed out.private IOException
IOException
caused by connection attempt, if any, ornull
.private int
TCP port to connect to.private Socket
Socket object, if the connection could be established, ornull
.Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionConnectiator
(InetAddress address, int port) Construct a newConnectiator
that can later be used connect to the given TCP port at the host specified. -
Method Summary
Modifier and TypeMethodDescriptionReturn exception caused by connection operation, if any, ornull
if no exception was thrown.Return socket created by connection establishment, ornull
if the connection could not be established.void
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 Details
-
address
Host to connect to. -
port
private int portTCP port to connect to. -
ioexception
IOException
caused by connection attempt, if any, ornull
. -
socket
Socket object, if the connection could be established, ornull
. -
hitTheBucket
private boolean hitTheBucketFlag to indicate that the socket is not needed, as the caller timed out.
-
-
Constructor Details
-
Connectiator
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 Details
-
run
public void run() -
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
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.
-