private CompletableFuture < Connection > createConnection ( Address address ) { return connectionFutures . computeIfAbsent ( address , a -> { CompletableFuture < Connection > future = client . connect ( address ) . thenApply ( connection -> { connection . onClose ( c -> connections . remove ( address , c ) ) ; connections . put ( address , connection ) ; return connection ; } ) ; future . whenComplete ( ( connection , error ) -> connectionFutures . remove ( address ) ) ; return future ; } ) ; }
Creates a connection for the given member .