Class SocketInitiator.SocketFuture

  • Enclosing class:
    SocketInitiator

    private class SocketInitiator.SocketFuture
    extends java.lang.Object
    The socket future is shared across all SocketInitiator.SocketRacer threads and aggregates the results. A socket future is considered fulfilled when...
    • any racer thread has established a socket in which case all other racers will be stopped, or
    • all racer threads returned with an exception, or
    • there was no racer thread (e.g. in case there is no network interface).
    In the first case, the socket will be returned. In all other cases, an exception will be thrown, indicating the failure type.
    • Field Detail

      • mLatch

        private java.util.concurrent.CountDownLatch mLatch
      • mSocket

        private java.net.Socket mSocket
      • mException

        private java.lang.Exception mException
    • Constructor Detail

      • SocketFuture

        private SocketFuture()
    • Method Detail

      • hasSocket

        boolean hasSocket()
      • setException

        void setException​(java.lang.Exception exception)
      • await

        java.net.Socket await​(java.util.List<SocketInitiator.SocketRacer> racers)
                       throws java.lang.Exception
        Throws:
        java.lang.Exception