Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在我的案例中,为什么进行更快的重试将提高成功率_Java - Fatal编程技术网

Java 在我的案例中,为什么进行更快的重试将提高成功率

Java 在我的案例中,为什么进行更快的重试将提高成功率,java,Java,我正在使用番石榴重试,当我将withWaitStrategy()设置为5秒时,有时会失败,但如果我将withWaitStrategy()更改为1秒,成功率为100%,为什么会发生这种情况?有人能帮我吗 Callable<Boolean> callable = () -> { itemBeforeUpdate.set(table.getItem(getActionHashKeyField(), hashKeyValue, getAction

我正在使用番石榴重试,当我将withWaitStrategy()设置为5秒时,有时会失败,但如果我将withWaitStrategy()更改为1秒,成功率为100%,为什么会发生这种情况?有人能帮我吗

        Callable<Boolean> callable = () -> {
            itemBeforeUpdate.set(table.getItem(getActionHashKeyField(), hashKeyValue, getActionRangeKeyField(), rangeKeyValue));

            return itemBeforeUpdate.get().asMap().get(testPayloadName).equals(itemBeforeUpdate.get().asMap().get(attributeName));
        };

        Retryer<Boolean> retryer = RetryerBuilder.<Boolean>newBuilder()
                .withWaitStrategy(WaitStrategies.fixedWait(1, TimeUnit.SECONDS))
                .withStopStrategy(StopStrategies.stopAfterDelay(50, TimeUnit.SECONDS))
                .withAttemptTimeLimiter(AttemptTimeLimiters.fixedTimeLimit(5, TimeUnit.SECONDS))
                .retryIfResult(BooleanUtils::isFalse)
                .build();

            retryer.call(callable);Callable<Boolean> callable = () -> {
            itemBeforeUpdate.set(table.getItem(getActionHashKeyField(), hashKeyValue, getActionRangeKeyField(), rangeKeyValue));

            return itemBeforeUpdate.get().asMap().get(testPayloadName).equals(itemBeforeUpdate.get().asMap().get(attributeName));
        };


            retryer.call(callable);
Callable Callable=()->{
itemBeforeUpdate.set(table.getItem(getActionHashKeyField(),hashKeyValue,getActionRangeKeyField(),rangeKeyValue));
返回itemBeforeUpdate.get().asMap().get(testPayloadName).equals(itemBeforeUpdate.get().asMap().get(attributeName));
};
Retryer-Retryer=RetryerBuilder.newBuilder()
.withWaitStrategy(WaitStrategys.fixedWait(1,时间单位。秒))
.使用停止策略(停止策略。停止后延迟(50,时间单位。秒))
.使用AttemptTimeLimiter(AttemptTimeLimiters.fixedTimeLimit(5,时间单位。秒))
.RetryFresult(BooleanUtils::isFalse)
.build();
retryer.call(可调用);可调用可调用=()->{
itemBeforeUpdate.set(table.getItem(getActionHashKeyField(),hashKeyValue,getActionRangeKeyField(),rangeKeyValue));
返回itemBeforeUpdate.get().asMap().get(testPayloadName).equals(itemBeforeUpdate.get().asMap().get(attributeName));
};
retryer.call(可调用);
我删除标签是因为尽管有名字,番石榴重试不是番石榴的一部分。我删除标签是因为尽管有名字,番石榴重试不是番石榴的一部分。