resilience4j失败 predicate 是否应该处理outofmemoryerror之类的错误?

r7xajy2e  于 2021-06-30  发布在  Java
关注(0)|答案(0)|浏览(176)

我有这样一个 predicate :

public class FailurePredicate implements Predicate<Throwable> {

    @Override
    public boolean test(final Throwable throwable) {
        boolean circuitBreakerAffected = false;

        if (throwable instanceof ApplicationException) {
            // Implementation not important for the question
            // circuitBreakerAffected = ...
        } else if (throwable instanceof Error) {
            // ???
        } else {
            circuitBreakerAffected = true;
        }

        return circuitBreakerAffected;
    }
   }

我想知道一些错误,比如 OutOfMemoryError 这通常表示出现严重故障,可能会正常关闭应用程序。
要求:
其他任务应尝试在正常关闭和关闭之前完成执行
resilliance4j在关闭时不允许执行新任务。
应该这样吗 Predicate 返回 true 或者 false 在同一时间 // ??? 有没有可能达到上述要求?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题