@VisibleForTesting boolean getAndRecordLeaderPingResult(@Nullable Future<Boolean> pingFuture) throws InterruptedException { if (pingFuture == null) { eventRecorder.recordLeaderPingTimeout(); return false; } try { boolean isLeader = pingFuture.get(); if (!isLeader) { eventRecorder.recordLeaderPingReturnedFalse(); } return isLeader; } catch (ExecutionException ex) { eventRecorder.recordLeaderPingFailure(ex.getCause()); return false; } }
@VisibleForTesting boolean getAndRecordLeaderPingResult(@Nullable Future<Boolean> pingFuture) throws InterruptedException { if (pingFuture == null) { eventRecorder.recordLeaderPingTimeout(); return false; } try { boolean isLeader = pingFuture.get(); if (!isLeader) { eventRecorder.recordLeaderPingReturnedFalse(); } return isLeader; } catch (ExecutionException ex) { eventRecorder.recordLeaderPingFailure(ex.getCause()); return false; } }