private SocketChannel connectToHost ( SocketAddress hostAddr ) throws IOException { SocketChannel socket = null ; while ( socket == null ) { try { socket = SocketChannel . open ( hostAddr ) ; } catch ( java . net . ConnectException e ) { LOG . warn ( "Joining host failed: " + e . getMessage ( ) + " retrying.." ) ; try { Thread . sleep ( 250 ) ; // milliseconds } catch ( InterruptedException dontcare ) { } } } return socket ; }
Create socket to the given host