All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.smallrye.faulttolerance.core.Invocation Maven / Gradle / Ivy

There is a newer version: 6.6.3
Show newest version
package io.smallrye.faulttolerance.core;

import static io.smallrye.faulttolerance.core.CoreLogger.LOG;

import java.util.concurrent.Callable;

/**
 * A "sentinel" fault tolerance strategy that does no processing, it only invokes the guarded {@link Callable}.
 * This is supposed to be used as the last fault tolerance stragegy in a chain.
 * 

* There's only one instance of this class, accessible using {@link #invocation()}. */ public final class Invocation implements FaultToleranceStrategy { private static final Invocation INSTANCE = new Invocation<>(); @SuppressWarnings("unchecked") public static Invocation invocation() { return (Invocation) INSTANCE; } private Invocation() { // avoid instantiation } @Override public V apply(InvocationContext ctx) throws Exception { LOG.trace("Guarded method invocation started"); try { return ctx.call(); } finally { LOG.trace("Guarded method invocation finished"); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy