Class OncRpcTcpSocketHelper.Connectiator

java.lang.Object
java.lang.Thread
org.acplt.oncrpc.OncRpcTcpSocketHelper.Connectiator
All Implemented Interfaces:
Runnable
Enclosing class:
OncRpcTcpSocketHelper

private class OncRpcTcpSocketHelper.Connectiator extends Thread
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.
  • Field Details

    • address

      private InetAddress address
      Host to connect to.
    • port

      private int port
      TCP port to connect to.
    • ioexception

      private IOException ioexception
      IOException caused by connection attempt, if any, or null.
    • socket

      private Socket socket
      Socket object, if the connection could be established, or null.
    • hitTheBucket

      private boolean hitTheBucket
      Flag to indicate that the socket is not needed, as the caller timed out.
  • Constructor Details

    • Connectiator

      public Connectiator(InetAddress address, int port)
      Construct a new Connectiator 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 the run() method.
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • getIOException

      public IOException getIOException()
      Return exception caused by connection operation, if any, or null 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 Socket getSocket()
      Return socket created by connection establishment, or null 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.