private void requestProbes ( ImmutableMember suspect ) { Collection < SwimMember > members = selectRandomMembers ( config . getSuspectProbes ( ) - 1 , suspect ) ; if ( ! members . isEmpty ( ) ) { AtomicInteger counter = new AtomicInteger ( ) ; AtomicBoolean succeeded = new AtomicBoolean ( ) ; for ( SwimMember member : members ) { requestProbe ( member , suspect ) . whenCompleteAsync ( ( success , error ) -> { int count = counter . incrementAndGet ( ) ; if ( error == null && success ) { succeeded . set ( true ) ; } // If the count is equal to the number of probe peers and no probe has succeeded, the node is unreachable. else if ( count == members . size ( ) && ! succeeded . get ( ) ) { failProbes ( suspect ) ; } } , swimScheduler ) ; } } else { failProbes ( suspect ) ; } }
Requests probes from n peers .