Class OncRpcTcpSocketHelper.Connectiator

  • All Implemented Interfaces:
    java.lang.Runnable
    Enclosing class:
    OncRpcTcpSocketHelper

    private class OncRpcTcpSocketHelper.Connectiator
    extends java.lang.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.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • 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, or null.
      private int port
      TCP port to connect to.
      private java.net.Socket socket
      Socket object, if the connection could be established, or null.
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      Connectiator​(java.net.InetAddress address, int port)
      Construct a new Connectiator 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, or null if no exception was thrown.
      java.net.Socket getSocket()
      Return socket created by connection establishment, or null 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
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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, or null.
      • socket

        private java.net.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 Detail

      • Connectiator

        public Connectiator​(java.net.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 Detail

      • run

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

        public java.io.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 java.net.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.