class Requests extends
        CompletableEventLatchSupport<Tuple2<RedisURI, TimedAsyncCommand<String, String, String>>, List<RedisNodeDescription>> {

    private final Map<RedisURI, TimedAsyncCommand<String, String, String>> rawViews = new TreeMap<>(
            ReplicaUtils.RedisURIComparator.INSTANCE);

    private final List<RedisNodeDescription> nodes;

    public Requests(int expectedCount, List<RedisNodeDescription> nodes) {
        super(expectedCount);
        this.nodes = nodes;
    }

    protected void addRequest(RedisURI redisURI, TimedAsyncCommand<String, String, String> command) {

        rawViews.put(redisURI, command);
        command.onComplete((s, throwable) -> {

            if (throwable != null) {
                accept(throwable);
            } else {
                accept(Tuples.of(redisURI, command));
            }
        });
    }

    @Override
    protected void onEmit(Emission<List<RedisNodeDescription>> emission) {<FILL_FUNCTION_BODY>}

    protected Set<RedisURI> nodes() {
        return rawViews.keySet();
    }

    protected TimedAsyncCommand<String, String, String> getRequest(RedisURI redisURI) {
        return rawViews.get(redisURI);
    }

}


        List<RedisNodeDescription> result = new ArrayList<>();

        Map<RedisNodeDescription, Long> latencies = new HashMap<>();

        for (RedisNodeDescription node : nodes) {

            TimedAsyncCommand<String, String, String> future = getRequest(node.getUri());

            if (future == null || !future.isDone()) {
                continue;
            }

            RedisNodeDescription redisNodeDescription = findNodeByUri(nodes, node.getUri());
            latencies.put(redisNodeDescription, future.duration());
            result.add(redisNodeDescription);
        }

        SortAction sortAction = SortAction.getSortAction();
        sortAction.sort(result, new LatencyComparator(latencies));

        emission.success(result);
    
<methods>public void <init>(int) ,public final void accept(Tuple2<io.lettuce.core.RedisURI,TimedAsyncCommand<java.lang.String,java.lang.String,java.lang.String>>) ,public final void accept(java.lang.Throwable) ,public final int getExpectedCount() ,public final CompletionStage<List<io.lettuce.core.models.role.RedisNodeDescription>> getOrTimeout(java.time.Duration, java.util.concurrent.ScheduledExecutorService) <variables>private static final int GATE_CLOSED,private static final int GATE_OPEN,private static final AtomicIntegerFieldUpdater<CompletableEventLatchSupport#RAW> GATE_UPDATER,private static final AtomicIntegerFieldUpdater<CompletableEventLatchSupport#RAW> NOTIFICATIONS_UPDATER,private final non-sealed int expectedCount,private volatile int gate,private volatile int notifications,private final CompletableFuture<List<io.lettuce.core.models.role.RedisNodeDescription>> selfFuture,private volatile ScheduledFuture<?> timeoutScheduleFuture