cyclops-react和async-retry:如何在超时时重试?

时间:2016-09-16 14:12:11

标签: java reactive-streams cyclops-react

我开始使用cyclops-react with async-retry。我还有点失落。

我使用SimpleReact并模拟服务器的超时但我从未收到类似这样的超时:

private List<Object> executeParallel() {
    List<Object> result = new SimpleReact(mainThreadPool)
            .of(getSupplier())
            .withRetrier(new AsyncRetryExecutor(retryThreadPool)
                    .abortIf((t) -> !TimeoutException.class.isAssignableFrom(t.getClass()))
            )
            .retry(retrySupplier())
            .block()
            .collect(Collectors.toList());
    return result;
}

private Supplier getSupplier() {
    return () -> someOperationThatTimesOut();
}

private Function<Supplier, Object> retrySupplier() {
    return supplier -> supplier.get();
}

那里缺少什么?

0 个答案:

没有答案