Class FaultTolerance

java.lang.Object
io.helidon.faulttolerance.FaultTolerance

public final class FaultTolerance extends Object
System-wide fault tolerance configuration and access to a customized sequence of fault tolerance handlers.

Fault tolerance provides the following features:

  • Bulkhead - limit number of parallel requests to a resource
  • CircuitBreaker - stop trying to request a failing resource until it becomes available
  • Fallback - fall back to another supplier of result in case the usual one fails
  • Retry - try to call a supplier again if invocation fails
  • Timeout - time out a request if it takes too long
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    A builder used for setting up a customized list of fault tolerance handlers.
    static class 
    A builder used for fault tolerance handlers that require a specific type to be used, such as Fallback.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Config key to enable metrics in Fault Tolerance.
  • Method Summary

    Modifier and Type
    Method
    Description
    A builder to configure a customized sequence of fault tolerance handlers.
    static void
    config(Config config)
    Deprecated, for removal: This API element is subject to removal in a future version.
    static void
    executor(Supplier<? extends ExecutorService> executor)
    Deprecated, for removal: This API element is subject to removal in a future version.
    this method will be removed without replacement; each fault tolerance component that supports executor service can be configured with such explicitly in its builder (i.e.
    static <T> Callable<T>
    toDelayedCallable(Callable<T> callable, long millis)
    Deprecated, for removal: This API element is subject to removal in a future version.
    this method was not intended for public use, and will be removed in a future version of Helidon
    static Runnable
    toDelayedRunnable(Runnable runnable, long millis)
    Deprecated, for removal: This API element is subject to removal in a future version.
    this method was not intended for public use, and will be removed in a future version of Helidon
    A typed builder to configure a customized sequence of fault tolerance handlers.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • FT_METRICS_DEFAULT_ENABLED

      public static final String FT_METRICS_DEFAULT_ENABLED
      Config key to enable metrics in Fault Tolerance. This flag can be overridden by each FT command builder. See for example BulkheadConfigBlueprint.enableMetrics(). All metrics are disabled by default.
      See Also:
  • Method Details

    • config

      @Deprecated(forRemoval=true, since="4.3.0") public static void config(Config config)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Configure Helidon wide defaults from a config instance. The default is now to use Services.get(Class) to get a configuration. This method will work as it used to, but fallback will always be to the config instance provided by service registry.
      Parameters:
      config - config to read fault tolerance configuration
    • executor

      @Deprecated(forRemoval=true, since="4.3.0") public static void executor(Supplier<? extends ExecutorService> executor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      this method will be removed without replacement; each fault tolerance component that supports executor service can be configured with such explicitly in its builder (i.e. AsyncConfig.BuilderBase.executor(java.util.concurrent.ExecutorService)). When using declarative, the executor service can be configured as a named service.
      Configure Helidon wide executor service for Fault Tolerance.
      Parameters:
      executor - executor service to use
    • builder

      public static FaultTolerance.Builder builder()
      A builder to configure a customized sequence of fault tolerance handlers.
      Returns:
      a new builder
    • typedBuilder

      public static <T> FaultTolerance.TypedBuilder<T> typedBuilder()
      A typed builder to configure a customized sequence of fault tolerance handlers.
      Type Parameters:
      T - type of result
      Returns:
      a new builder
    • toDelayedRunnable

      @Deprecated(forRemoval=true, since="4.3.0") public static Runnable toDelayedRunnable(Runnable runnable, long millis)
      Deprecated, for removal: This API element is subject to removal in a future version.
      this method was not intended for public use, and will be removed in a future version of Helidon
      Converts a Runnable into another that sleeps for millis before executing. Simulates a scheduled executor when using VTs.
      Parameters:
      runnable - the runnable
      millis - the time to sleep
      Returns:
      the new runnable
    • toDelayedCallable

      @Deprecated(forRemoval=true, since="4.3.0") public static <T> Callable<T> toDelayedCallable(Callable<T> callable, long millis)
      Deprecated, for removal: This API element is subject to removal in a future version.
      this method was not intended for public use, and will be removed in a future version of Helidon
      Converts a Callable into another that sleeps for millis before executing. Simulates a scheduled executor when using VTs.
      Type Parameters:
      T - type of value returned
      Parameters:
      callable - the callable
      millis - the time to sleep
      Returns:
      the new callable