Class StandaloneFaultTolerance

java.lang.Object
io.smallrye.faulttolerance.standalone.StandaloneFaultTolerance

public final class StandaloneFaultTolerance extends Object
Integration point for standalone usage of SmallRye Fault Tolerance. Allows custom configuration and shutting down the supporting infrastructure.

The configure() method accepts an implementation of the Configuration interface. It must be called before the first use of SmallRye Fault Tolerance, and it may only be called once.

The shutdown() method should be called during application shutdown, when SmallRye Fault Tolerance is not supposed to be used anymore. It shuts down all internally created resources (such as a timer) and then calls Configuration.onShutdown(). SmallRye Fault Tolerance must not be used after shutdown() is called.

  • Constructor Details

    • StandaloneFaultTolerance

      public StandaloneFaultTolerance()
  • Method Details

    • configure

      public static void configure(Configuration configuration)
      Makes sure that the given configuration is used by SmallRye Fault Tolerance. Throws an exception when configuration was already set or when SmallRye Fault Tolerance has already read the configuration and reconfiguration is not possible.
      Parameters:
      configuration - custom Configuration implementation, must not be null
    • timerAccess

      @Deprecated(forRemoval=true) public static TimerAccess timerAccess()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Provides access to the timer that SmallRye Fault Tolernce internally uses for scheduling purposes. It provides a read-only view into what the timer is doing.
      Returns:
      read-only view into the SmallRye Fault Tolerance timer
    • shutdown

      public static void shutdown() throws InterruptedException
      Asks SmallRye Fault Tolerance to shut down. If custom configuration was provided using configure(), the Configuration.onShutdown() method is called as the last step.

      After this method is called, no thread may use the SmallRye Fault Tolerance API.

      Throws:
      InterruptedException - when the shutdown process is interrupted