├── .editorconfig ├── .github ├── dependabot.yml ├── maven-ci-settings.xml ├── project.yml └── workflows │ ├── build.yml │ ├── prepare-release.yml │ ├── publish-tck.yml │ ├── release.yml │ └── review-release.yml ├── .gitignore ├── CODEOWNERS ├── LICENSE ├── README.adoc ├── api ├── pom.xml └── src │ ├── main │ └── java │ │ └── io │ │ └── smallrye │ │ └── faulttolerance │ │ └── api │ │ ├── AlwaysOnException.java │ │ ├── ApplyFaultTolerance.java │ │ ├── ApplyGuard.java │ │ ├── AsynchronousNonBlocking.java │ │ ├── BeforeRetry.java │ │ ├── BeforeRetryHandler.java │ │ ├── CircuitBreakerMaintenance.java │ │ ├── CircuitBreakerName.java │ │ ├── CircuitBreakerState.java │ │ ├── CustomBackoff.java │ │ ├── CustomBackoffStrategy.java │ │ ├── ExponentialBackoff.java │ │ ├── FaultTolerance.java │ │ ├── FibonacciBackoff.java │ │ ├── Guard.java │ │ ├── NeverOnResult.java │ │ ├── RateLimit.java │ │ ├── RateLimitException.java │ │ ├── RateLimitType.java │ │ ├── RetryWhen.java │ │ ├── Spi.java │ │ ├── SpiAccess.java │ │ └── TypedGuard.java │ └── test │ └── java │ └── io │ └── smallrye │ └── faulttolerance │ └── api │ └── GuardBuilderConsistencyTest.java ├── doc ├── antora-playbook.yml ├── antora.yml └── modules │ └── ROOT │ ├── nav.adoc │ ├── pages │ ├── howto │ │ ├── asynchronous.adoc │ │ ├── begin.adoc │ │ ├── bulkhead.adoc │ │ ├── circuit-breaker.adoc │ │ ├── fallback.adoc │ │ ├── multiple.adoc │ │ ├── rate-limit.adoc │ │ ├── retry.adoc │ │ └── timeout.adoc │ ├── index.adoc │ ├── integration │ │ ├── async-types.adoc │ │ ├── context-propagation.adoc │ │ ├── event-loop.adoc │ │ ├── intro.adoc │ │ ├── kotlin.adoc │ │ ├── metrics.adoc │ │ ├── opentracing.adoc │ │ ├── programmatic-api.adoc │ │ └── thread-pool.adoc │ ├── internals │ │ ├── config.adoc │ │ ├── core.adoc │ │ ├── instructions.adoc │ │ ├── logging.adoc │ │ └── project-structure.adoc │ └── reference │ │ ├── asynchronous.adoc │ │ ├── bulkhead.adoc │ │ ├── circuit-breaker.adoc │ │ ├── config.adoc │ │ ├── fallback.adoc │ │ ├── metrics.adoc │ │ ├── non-compat.adoc │ │ ├── programmatic-api.adoc │ │ ├── rate-limit.adoc │ │ ├── retry.adoc │ │ ├── reusable.adoc │ │ └── timeout.adoc │ └── partials │ ├── internals.adoc │ ├── non-compat.adoc │ ├── srye-feature.adoc │ └── time-unit-inconsistency.adoc ├── implementation ├── apiimpl │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── smallrye │ │ └── faulttolerance │ │ ├── apiimpl │ │ ├── AsyncInvocation.java │ │ ├── BasicCircuitBreakerMaintenanceImpl.java │ │ ├── BasicMeteredOperationImpl.java │ │ ├── BuilderEagerDependencies.java │ │ ├── BuilderLazyDependencies.java │ │ ├── CallableInvoker.java │ │ ├── EventHandlers.java │ │ ├── FaultToleranceImpl.java │ │ ├── GuardCommon.java │ │ ├── GuardImpl.java │ │ ├── LazyFaultTolerance.java │ │ ├── LazyGuard.java │ │ ├── LazyTypedGuard.java │ │ └── TypedGuardImpl.java │ │ └── basicconfig │ │ ├── BasicFaultToleranceOperation.java │ │ ├── BulkheadConfig.java │ │ ├── CircuitBreakerConfig.java │ │ ├── ConfigUtil.java │ │ ├── ExponentialBackoffConfig.java │ │ ├── FibonacciBackoffConfig.java │ │ ├── RateLimitConfig.java │ │ ├── RetryConfig.java │ │ └── TimeoutConfig.java ├── autoconfig │ ├── core │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── io │ │ │ └── smallrye │ │ │ └── faulttolerance │ │ │ └── autoconfig │ │ │ ├── AutoConfig.java │ │ │ ├── Config.java │ │ │ ├── ConfigConstants.java │ │ │ ├── ConfigDeclarativeOnly.java │ │ │ ├── FaultToleranceMethod.java │ │ │ ├── KotlinSupport.java │ │ │ └── MethodDescriptor.java │ ├── pom.xml │ └── processor │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── smallrye │ │ │ └── faulttolerance │ │ │ └── autoconfig │ │ │ └── processor │ │ │ ├── AutoConfigProcessor.java │ │ │ └── TypeNames.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── javax.annotation.processing.Processor ├── context-propagation │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── smallrye │ │ │ └── faulttolerance │ │ │ └── propagation │ │ │ ├── ContextPropagationRequestContextControllerProvider.java │ │ │ └── ContextPropagationRunnableWrapper.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── io.smallrye.faulttolerance.core.util.RunnableWrapper │ │ └── io.smallrye.faulttolerance.internal.RequestContextControllerProvider ├── core │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── smallrye │ │ │ │ └── faulttolerance │ │ │ │ └── core │ │ │ │ ├── Completer.java │ │ │ │ ├── CoreLogger.java │ │ │ │ ├── FailureContext.java │ │ │ │ ├── FaultToleranceContext.java │ │ │ │ ├── FaultToleranceEvent.java │ │ │ │ ├── FaultToleranceStrategy.java │ │ │ │ ├── Future.java │ │ │ │ ├── FutureImpl.java │ │ │ │ ├── FutureLoop.java │ │ │ │ ├── Invocation.java │ │ │ │ ├── async │ │ │ │ ├── AsyncLogger.java │ │ │ │ ├── FutureCancellationEvent.java │ │ │ │ ├── FutureExecution.java │ │ │ │ ├── RememberEventLoop.java │ │ │ │ ├── SyncAsyncSplit.java │ │ │ │ ├── ThreadOffload.java │ │ │ │ └── ThreadOffloadEnabled.java │ │ │ │ ├── bulkhead │ │ │ │ ├── Bulkhead.java │ │ │ │ ├── BulkheadEvents.java │ │ │ │ └── BulkheadLogger.java │ │ │ │ ├── circuit │ │ │ │ └── breaker │ │ │ │ │ ├── BitsetRollingWindow.java │ │ │ │ │ ├── CircuitBreaker.java │ │ │ │ │ ├── CircuitBreakerEvents.java │ │ │ │ │ ├── CircuitBreakerLogger.java │ │ │ │ │ ├── NaiveRollingWindow.java │ │ │ │ │ └── RollingWindow.java │ │ │ │ ├── event │ │ │ │ └── loop │ │ │ │ │ ├── EventLoop.java │ │ │ │ │ ├── EventLoopLogger.java │ │ │ │ │ └── NoEventLoop.java │ │ │ │ ├── fallback │ │ │ │ ├── Fallback.java │ │ │ │ ├── FallbackEvents.java │ │ │ │ ├── FallbackFunction.java │ │ │ │ ├── FallbackLogger.java │ │ │ │ └── ThreadOffloadFallbackFunction.java │ │ │ │ ├── invocation │ │ │ │ ├── AsyncSupport.java │ │ │ │ ├── AsyncSupportRegistry.java │ │ │ │ ├── CompletionStageSupport.java │ │ │ │ ├── ConstantInvoker.java │ │ │ │ ├── Invoker.java │ │ │ │ ├── NormalMethodInvoker.java │ │ │ │ ├── SpecialMethodInvoker.java │ │ │ │ └── StrategyInvoker.java │ │ │ │ ├── metrics │ │ │ │ ├── DelegatingMeteredOperation.java │ │ │ │ ├── DelegatingMetricsCollector.java │ │ │ │ ├── GeneralMetricsEvents.java │ │ │ │ ├── MeteredOperation.java │ │ │ │ ├── MeteredOperationName.java │ │ │ │ ├── MetricsCollector.java │ │ │ │ ├── MetricsConstants.java │ │ │ │ ├── MetricsLogger.java │ │ │ │ ├── MetricsProvider.java │ │ │ │ ├── MetricsRecorder.java │ │ │ │ ├── MicroProfileMetricsRecorder.java │ │ │ │ ├── MicrometerRecorder.java │ │ │ │ └── OpenTelemetryRecorder.java │ │ │ │ ├── package-info.java │ │ │ │ ├── rate │ │ │ │ └── limit │ │ │ │ │ ├── FixedWindow.java │ │ │ │ │ ├── NaiveRollingWindow.java │ │ │ │ │ ├── RateLimit.java │ │ │ │ │ ├── RateLimitEvents.java │ │ │ │ │ ├── RateLimitLogger.java │ │ │ │ │ ├── RingBufferRollingWindow.java │ │ │ │ │ ├── SmoothWindow.java │ │ │ │ │ └── TimeWindow.java │ │ │ │ ├── retry │ │ │ │ ├── AsyncDelay.java │ │ │ │ ├── BackOff.java │ │ │ │ ├── ConstantBackOff.java │ │ │ │ ├── CustomBackOff.java │ │ │ │ ├── ExponentialBackOff.java │ │ │ │ ├── FibonacciBackOff.java │ │ │ │ ├── FixedJitter.java │ │ │ │ ├── Jitter.java │ │ │ │ ├── RandomJitter.java │ │ │ │ ├── Retry.java │ │ │ │ ├── RetryEvents.java │ │ │ │ ├── RetryLogger.java │ │ │ │ ├── SyncDelay.java │ │ │ │ ├── SyncDelayAsAsync.java │ │ │ │ ├── ThreadSleepDelay.java │ │ │ │ └── TimerDelay.java │ │ │ │ ├── stopwatch │ │ │ │ ├── RunningStopwatch.java │ │ │ │ ├── Stopwatch.java │ │ │ │ └── SystemStopwatch.java │ │ │ │ ├── timeout │ │ │ │ ├── FutureTimeout.java │ │ │ │ ├── FutureTimeoutNotification.java │ │ │ │ ├── Timeout.java │ │ │ │ ├── TimeoutEvents.java │ │ │ │ ├── TimeoutExecution.java │ │ │ │ └── TimeoutLogger.java │ │ │ │ ├── timer │ │ │ │ ├── ThreadTimer.java │ │ │ │ ├── Timer.java │ │ │ │ ├── TimerLogger.java │ │ │ │ └── TimerTask.java │ │ │ │ └── util │ │ │ │ ├── Callbacks.java │ │ │ │ ├── Durations.java │ │ │ │ ├── ExceptionDecision.java │ │ │ │ ├── Preconditions.java │ │ │ │ ├── PredicateBasedExceptionDecision.java │ │ │ │ ├── PredicateBasedResultDecision.java │ │ │ │ ├── Primitives.java │ │ │ │ ├── ResultDecision.java │ │ │ │ ├── RunnableWrapper.java │ │ │ │ ├── SetBasedExceptionDecision.java │ │ │ │ ├── SetOfThrowables.java │ │ │ │ └── SneakyThrow.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── io.smallrye.faulttolerance.core.invocation.AsyncSupport │ │ └── test │ │ └── java │ │ └── io │ │ └── smallrye │ │ └── faulttolerance │ │ └── core │ │ ├── FaultToleranceContextUtil.java │ │ ├── FutureStressTest.java │ │ ├── FutureTest.java │ │ ├── InvocationTest.java │ │ ├── async │ │ └── FutureExecutionTest.java │ │ ├── bulkhead │ │ ├── BulkheadAsyncTest.java │ │ ├── BulkheadFutureTest.java │ │ └── BulkheadSyncTest.java │ │ ├── circuit │ │ └── breaker │ │ │ ├── AbstractRollingWindowTest.java │ │ │ ├── BitsetRollingWindowTest.java │ │ │ ├── CircuitBreakerAsyncTest.java │ │ │ ├── CircuitBreakerFutureTest.java │ │ │ ├── CircuitBreakerSyncTest.java │ │ │ ├── DefaultRollingWindowTest.java │ │ │ └── NaiveRollingWindowTest.java │ │ ├── composition │ │ ├── CircuitBreakerAndRetryTest.java │ │ ├── FallbackAndRetryTest.java │ │ ├── Strategies.java │ │ └── package-info.java │ │ ├── fallback │ │ ├── FallbackAsyncTest.java │ │ ├── FallbackFutureTest.java │ │ └── FallbackSyncTest.java │ │ ├── metrics │ │ └── GeneralMetricsTest.java │ │ ├── rate │ │ └── limit │ │ │ ├── AbstractRollingWindowTest.java │ │ │ ├── FixedWindowTest.java │ │ │ ├── NaiveRollingWindowTest.java │ │ │ ├── RateLimitAsyncTest.java │ │ │ ├── RateLimitSyncTest.java │ │ │ ├── RingBufferRollingWindowTest.java │ │ │ └── SmoothWindowTest.java │ │ ├── retry │ │ ├── ConstantBackOffTest.java │ │ ├── ExponentialBackOffTest.java │ │ ├── FibonacciBackOffTest.java │ │ ├── FixedJitterTest.java │ │ ├── RandomJitterTest.java │ │ ├── RetryAsyncTest.java │ │ ├── RetryFutureTest.java │ │ ├── RetrySyncTest.java │ │ ├── TestDelay.java │ │ └── TestInvocation.java │ │ ├── stopwatch │ │ ├── SystemStopwatchTest.java │ │ └── TestStopwatch.java │ │ ├── timeout │ │ ├── RealWorldAsyncTimeoutTest.java │ │ ├── TestTimer.java │ │ ├── TimeoutAsyncTest.java │ │ ├── TimeoutExecutionTest.java │ │ ├── TimeoutFutureTest.java │ │ └── TimeoutSyncTest.java │ │ ├── timer │ │ ├── TestTimer.java │ │ ├── ThreadTimerStressTest.java │ │ └── ThreadTimerTest.java │ │ └── util │ │ ├── Action.java │ │ ├── CallbacksTest.java │ │ ├── DurationsTest.java │ │ ├── PredicateBasedExceptionDecisionTest.java │ │ ├── PrimitivesTest.java │ │ ├── SetBasedExceptionDecisionTest.java │ │ ├── SetOfThrowablesTest.java │ │ ├── TestException.java │ │ ├── TestExecutor.java │ │ ├── TestInvocation.java │ │ ├── TestThread.java │ │ ├── Timing.java │ │ ├── barrier │ │ ├── Barrier.java │ │ └── BarrierImpl.java │ │ └── party │ │ ├── Party.java │ │ └── PartyImpl.java ├── fault-tolerance │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── smallrye │ │ │ │ └── faulttolerance │ │ │ │ ├── AsyncExecutorProvider.java │ │ │ │ ├── BeforeRetryHandlerProvider.java │ │ │ │ ├── CdiLogger.java │ │ │ │ ├── CdiSpi.java │ │ │ │ ├── CircuitBreakerMaintenanceImpl.java │ │ │ │ ├── DefaultAsyncExecutorProvider.java │ │ │ │ ├── DefaultBeforeRetryHandlerProvider.java │ │ │ │ ├── DefaultExistingCircuitBreakerNames.java │ │ │ │ ├── DefaultFallbackHandlerProvider.java │ │ │ │ ├── DefaultFaultToleranceOperationProvider.java │ │ │ │ ├── Enablement.java │ │ │ │ ├── ExecutionContextImpl.java │ │ │ │ ├── ExecutorHolder.java │ │ │ │ ├── ExistingCircuitBreakerNames.java │ │ │ │ ├── FallbackHandlerProvider.java │ │ │ │ ├── FaultToleranceBinding.java │ │ │ │ ├── FaultToleranceExtension.java │ │ │ │ ├── FaultToleranceInterceptor.java │ │ │ │ ├── FaultToleranceOperationProvider.java │ │ │ │ ├── RequestContextIntegration.java │ │ │ │ ├── SecurityActions.java │ │ │ │ ├── SpecCompatibility.java │ │ │ │ ├── config │ │ │ │ ├── ApplyFaultToleranceConfig.java │ │ │ │ ├── ApplyGuardConfig.java │ │ │ │ ├── AsynchronousConfig.java │ │ │ │ ├── AsynchronousNonBlockingConfig.java │ │ │ │ ├── BeforeRetryConfig.java │ │ │ │ ├── BlockingConfig.java │ │ │ │ ├── CircuitBreakerNameConfig.java │ │ │ │ ├── CustomBackoffConfig.java │ │ │ │ ├── FallbackConfig.java │ │ │ │ ├── FallbackValidation.java │ │ │ │ ├── FaultToleranceMethods.java │ │ │ │ ├── FaultToleranceOperation.java │ │ │ │ ├── KotlinSupport.java │ │ │ │ ├── NonBlockingConfig.java │ │ │ │ ├── RetryWhenConfig.java │ │ │ │ └── SecurityActions.java │ │ │ │ ├── internal │ │ │ │ ├── BeforeRetryMethod.java │ │ │ │ ├── DefaultRequestContextControllerProvider.java │ │ │ │ ├── FallbackMethod.java │ │ │ │ ├── FallbackMethodCandidates.java │ │ │ │ ├── InterceptionInvoker.java │ │ │ │ ├── InterceptionPoint.java │ │ │ │ ├── InternalLogger.java │ │ │ │ ├── KotlinSupport.java │ │ │ │ ├── RequestContextControllerProvider.java │ │ │ │ ├── RequestScopeActivator.java │ │ │ │ └── StrategyCache.java │ │ │ │ └── metrics │ │ │ │ ├── CdiMeteredOperationImpl.java │ │ │ │ ├── CompoundMetricsProvider.java │ │ │ │ ├── MetricsIntegration.java │ │ │ │ ├── MicroProfileMetricsProvider.java │ │ │ │ ├── MicrometerProvider.java │ │ │ │ ├── NoopProvider.java │ │ │ │ └── OpenTelemetryProvider.java │ │ └── resources │ │ │ ├── META-INF │ │ │ └── services │ │ │ │ ├── io.smallrye.faulttolerance.api.Spi │ │ │ │ └── jakarta.enterprise.inject.spi.Extension │ │ │ └── smallrye-fault-tolerance.properties │ │ └── test │ │ └── java │ │ └── io │ │ └── smallrye │ │ └── faulttolerance │ │ └── config │ │ ├── FallbackValidationTest.java │ │ └── InterfaceFaultToleranceOperationsTest.java ├── kotlin │ ├── pom.xml │ └── src │ │ └── main │ │ ├── kotlin │ │ └── io │ │ │ └── smallrye │ │ │ └── faulttolerance │ │ │ └── kotlin │ │ │ └── impl │ │ │ └── CoroutineSupport.kt │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── io.smallrye.faulttolerance.core.invocation.AsyncSupport ├── mutiny │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── smallrye │ │ │ │ └── faulttolerance │ │ │ │ └── mutiny │ │ │ │ ├── api │ │ │ │ └── MutinyFaultTolerance.java │ │ │ │ └── impl │ │ │ │ └── UniSupport.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── io.smallrye.faulttolerance.core.invocation.AsyncSupport │ │ └── test │ │ └── java │ │ └── io │ │ └── smallrye │ │ └── faulttolerance │ │ └── mutiny │ │ └── test │ │ ├── MutinyBulkheadTest.java │ │ ├── MutinyCircuitBreakerTest.java │ │ ├── MutinyFallbackTest.java │ │ ├── MutinyPassthroughTest.java │ │ ├── MutinyResubscriptionTest.java │ │ ├── MutinyRetryTest.java │ │ ├── MutinyTimeoutTest.java │ │ ├── MutinyUntypedGuardTest.java │ │ └── Types.java ├── pom.xml ├── rxjava3 │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── smallrye │ │ │ └── faulttolerance │ │ │ └── rxjava3 │ │ │ └── impl │ │ │ ├── CompletableSupport.java │ │ │ ├── MaybeSupport.java │ │ │ └── SingleSupport.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── io.smallrye.faulttolerance.core.invocation.AsyncSupport ├── standalone │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── smallrye │ │ │ │ └── faulttolerance │ │ │ │ └── standalone │ │ │ │ ├── Configuration.java │ │ │ │ ├── DefaultConfiguration.java │ │ │ │ ├── EagerDependencies.java │ │ │ │ ├── LazyDependencies.java │ │ │ │ ├── MetricsAdapter.java │ │ │ │ ├── MicrometerAdapter.java │ │ │ │ ├── NoopAdapter.java │ │ │ │ ├── OpenTelemetryAdapter.java │ │ │ │ ├── StandaloneFaultTolerance.java │ │ │ │ ├── StandaloneSpi.java │ │ │ │ ├── TimerAccess.java │ │ │ │ └── TimerAccessImpl.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── io.smallrye.faulttolerance.api.Spi │ │ └── test │ │ ├── java │ │ └── io │ │ │ └── smallrye │ │ │ └── faulttolerance │ │ │ └── standalone │ │ │ └── test │ │ │ ├── StandaloneBulkheadAsyncEventsTest.java │ │ │ ├── StandaloneBulkheadAsyncTest.java │ │ │ ├── StandaloneBulkheadEventsTest.java │ │ │ ├── StandaloneBulkheadTest.java │ │ │ ├── StandaloneCircuitBreakerAsyncEventsTest.java │ │ │ ├── StandaloneCircuitBreakerAsyncTest.java │ │ │ ├── StandaloneCircuitBreakerEventsTest.java │ │ │ ├── StandaloneCircuitBreakerMaintenanceTest.java │ │ │ ├── StandaloneCircuitBreakerTest.java │ │ │ ├── StandaloneFallbackAsyncTest.java │ │ │ ├── StandaloneFallbackTest.java │ │ │ ├── StandaloneMetricsTest.java │ │ │ ├── StandaloneMetricsTimerTest.java │ │ │ ├── StandalonePassthroughAsyncTest.java │ │ │ ├── StandalonePassthroughTest.java │ │ │ ├── StandaloneRateLimitAsyncEventsTest.java │ │ │ ├── StandaloneRateLimitAsyncTest.java │ │ │ ├── StandaloneRateLimitEventsTest.java │ │ │ ├── StandaloneRateLimitTest.java │ │ │ ├── StandaloneRetryAsyncEventsTest.java │ │ │ ├── StandaloneRetryAsyncTest.java │ │ │ ├── StandaloneRetryEventsTest.java │ │ │ ├── StandaloneRetryTest.java │ │ │ ├── StandaloneThreadOffloadTest.java │ │ │ ├── StandaloneTimeoutAsyncEventsTest.java │ │ │ ├── StandaloneTimeoutAsyncTest.java │ │ │ ├── StandaloneTimeoutEventsTest.java │ │ │ ├── StandaloneTimeoutTest.java │ │ │ ├── StandaloneUntypedAsyncGuardTest.java │ │ │ ├── StandaloneUntypedGuardTest.java │ │ │ └── Types.java │ │ └── resources │ │ └── logging.properties ├── tracing-propagation │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── smallrye │ │ │ └── faulttolerance │ │ │ └── tracing │ │ │ └── TracingContextProvider.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.eclipse.microprofile.context.spi.ThreadContextProvider └── vertx │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── io │ │ └── smallrye │ │ └── faulttolerance │ │ └── vertx │ │ ├── VertxEventLoop.java │ │ ├── VertxExecutor.java │ │ └── VertxLogger.java │ └── resources │ └── META-INF │ └── services │ └── io.smallrye.faulttolerance.core.event.loop.EventLoop ├── message-ranges.txt ├── pom.xml ├── release └── pom.xml └── testsuite ├── basic ├── pom.xml └── src │ └── test │ ├── java │ └── io │ │ └── smallrye │ │ └── faulttolerance │ │ ├── FaultToleranceOperations.java │ │ ├── Types.java │ │ ├── async │ │ ├── additional │ │ │ ├── asyncnonblocking │ │ │ │ ├── AsyncNonBlockingHelloService.java │ │ │ │ ├── AsyncNonBlockingTest.java │ │ │ │ ├── fallback │ │ │ │ │ ├── FallbackAsyncNonBlockingHelloService.java │ │ │ │ │ └── FallbackAsyncNonBlockingTest.java │ │ │ │ ├── priority │ │ │ │ │ ├── AsyncNonBlockingPriorityHelloService.java │ │ │ │ │ └── AsyncNonBlockingPriorityTest.java │ │ │ │ └── retry │ │ │ │ │ ├── RetryAsyncNonBlockingHelloService.java │ │ │ │ │ └── RetryAsyncNonBlockingTest.java │ │ │ ├── blocking │ │ │ │ ├── BlockingAsyncTest.java │ │ │ │ ├── BlockingHelloService.java │ │ │ │ ├── fallback │ │ │ │ │ ├── FallbackBlockingAsyncTest.java │ │ │ │ │ └── FallbackBlockingHelloService.java │ │ │ │ ├── priority │ │ │ │ │ ├── BlockingPriorityAsyncTest.java │ │ │ │ │ └── BlockingPriorityHelloService.java │ │ │ │ ├── retry │ │ │ │ │ ├── RetryBlockingAsyncTest.java │ │ │ │ │ └── RetryBlockingHelloService.java │ │ │ │ └── unguarded │ │ │ │ │ ├── UnguardedBlockingAsyncTest.java │ │ │ │ │ └── UnguardedBlockingHelloService.java │ │ │ ├── error │ │ │ │ ├── clazz │ │ │ │ │ ├── BlockingNonBlockingOnClassService.java │ │ │ │ │ ├── BlockingNonBlockingOnClassTest.java │ │ │ │ │ ├── BothAsyncOnClassService.java │ │ │ │ │ └── BothAsyncOnClassTest.java │ │ │ │ └── method │ │ │ │ │ ├── BlockingNonBlockingOnMethodService.java │ │ │ │ │ ├── BlockingNonBlockingOnMethodTest.java │ │ │ │ │ ├── BothAsyncOnMethodService.java │ │ │ │ │ └── BothAsyncOnMethodTest.java │ │ │ └── nonblocking │ │ │ │ ├── NonblockingAsyncTest.java │ │ │ │ ├── NonblockingHelloService.java │ │ │ │ ├── fallback │ │ │ │ ├── FallbackNonblockingAsyncTest.java │ │ │ │ └── FallbackNonblockingHelloService.java │ │ │ │ ├── priority │ │ │ │ ├── NonblockingPriorityAsyncTest.java │ │ │ │ └── NonblockingPriorityHelloService.java │ │ │ │ ├── retry │ │ │ │ ├── RetryNonblockingAsyncTest.java │ │ │ │ └── RetryNonblockingHelloService.java │ │ │ │ └── unguarded │ │ │ │ ├── UnguardedNonblockingAsyncTest.java │ │ │ │ └── UnguardedNonblockingHelloService.java │ │ ├── circuitbreaker │ │ │ ├── AsyncHelloService.java │ │ │ └── AsynchronousCircuitBreakerTest.java │ │ ├── compstage │ │ │ ├── bulkhead │ │ │ │ ├── stress │ │ │ │ │ ├── BulkheadService.java │ │ │ │ │ └── CompletionStageThreadPoolBulkheadStressTest.java │ │ │ │ └── timeout │ │ │ │ │ └── fallback │ │ │ │ │ ├── AsyncCompletionStageThreadPoolBulkheadTimeoutFallbackTest.java │ │ │ │ │ └── AsyncHelloService.java │ │ │ ├── circuit │ │ │ │ └── breaker │ │ │ │ │ ├── failon │ │ │ │ │ └── halfopen │ │ │ │ │ │ ├── AsyncHelloService.java │ │ │ │ │ │ └── CompletionStageCircuitBreakerFailOnHalfOpenTest.java │ │ │ │ │ ├── halfopen │ │ │ │ │ ├── AsyncHelloService.java │ │ │ │ │ └── CompletionStageCircuitBreakerHalfOpenTest.java │ │ │ │ │ └── timer │ │ │ │ │ └── halfopen │ │ │ │ │ ├── AsyncHelloService.java │ │ │ │ │ └── CompletionStageCircuitBreakerTimerHalfOpenTest.java │ │ │ ├── exception │ │ │ │ ├── AsyncHelloService.java │ │ │ │ ├── AsynchronousCompletionStageExceptionHandlingTest.java │ │ │ │ └── HelloException.java │ │ │ ├── fallback │ │ │ │ ├── AsyncHelloService.java │ │ │ │ └── AsynchronousCompletionStageFallbackTest.java │ │ │ ├── ratelimit │ │ │ │ ├── CompletionStageRateLimitTest.java │ │ │ │ └── MyService.java │ │ │ └── retry │ │ │ │ ├── AsyncHelloService.java │ │ │ │ ├── AsynchronousCompletionStageRetryTest.java │ │ │ │ ├── beforeretry │ │ │ │ ├── AsyncHelloService.java │ │ │ │ └── AsynchronousCompletionStageRetryTest.java │ │ │ │ └── circuit │ │ │ │ └── breaker │ │ │ │ └── fallback │ │ │ │ ├── AsyncCompletionStageRetryCircuitBreakerFallbackTest.java │ │ │ │ └── AsyncHelloService.java │ │ ├── fallback │ │ │ ├── AsyncHelloService.java │ │ │ └── AsynchronousFallbackTest.java │ │ ├── future │ │ │ ├── AsynchronousMethodNotFutureTest.java │ │ │ ├── WrongReturnType.java │ │ │ └── bulkhead │ │ │ │ └── stress │ │ │ │ ├── BulkheadService.java │ │ │ │ └── FutureBulkheadStressTest.java │ │ ├── noncompatible │ │ │ ├── NoncompatibleNonblockingAsyncTest.java │ │ │ └── NoncompatibleNonblockingHelloService.java │ │ ├── retry │ │ │ ├── AsyncHelloService.java │ │ │ └── AsynchronousRetryTest.java │ │ ├── sizing │ │ │ ├── AbstractAsyncThreadPoolSizingTest.java │ │ │ ├── AsyncThreadPoolSizingOldConfigTest.java │ │ │ ├── AsyncThreadPoolSizingTest.java │ │ │ └── HelloService.java │ │ └── types │ │ │ ├── mutiny │ │ │ ├── HelloService.java │ │ │ ├── MutinyTest.java │ │ │ └── resubscription │ │ │ │ ├── HelloService.java │ │ │ │ └── MutinyResubscriptionTest.java │ │ │ └── rxjava │ │ │ ├── HelloService.java │ │ │ ├── RxjavaTest.java │ │ │ └── resubscription │ │ │ ├── HelloService.java │ │ │ └── RxjavaResubscriptionTest.java │ │ ├── basic │ │ ├── CommandInterceptorTest.java │ │ ├── FutureStringFallbackHandler.java │ │ ├── MyFallbackHandler.java │ │ ├── MyMicroservice.java │ │ ├── MyRetryMicroservice.java │ │ ├── SharedFallback.java │ │ └── StringFallbackHandler.java │ │ ├── bulkhead │ │ ├── BulkheadTest.java │ │ ├── PingService.java │ │ ├── capacity │ │ │ └── overflow │ │ │ │ ├── BulkheadCapacityOverflowTest.java │ │ │ │ └── MyService.java │ │ └── reject │ │ │ ├── BulkheadFallbackRejectTest.java │ │ │ └── PingService.java │ │ ├── circuitbreaker │ │ ├── failon │ │ │ ├── CircuitBreakerFailOnTest.java │ │ │ ├── PingService.java │ │ │ ├── halfopen │ │ │ │ ├── CircuitBreakerFailOnHalfOpenTest.java │ │ │ │ └── HelloService.java │ │ │ └── metrics │ │ │ │ ├── CircuitBreakerFailOnMetricsTest.java │ │ │ │ └── PingService.java │ │ ├── halfopen │ │ │ ├── CircuitBreakerHalfOpenTest.java │ │ │ └── HelloService.java │ │ ├── lastsuccess │ │ │ └── CircuitBreakerLastSuccessOpensTest.java │ │ ├── maintenance │ │ │ ├── CircuitBreakerMaintenanceInteroperabilityTest.java │ │ │ ├── CircuitBreakerMaintenanceTest.java │ │ │ ├── HelloService.java │ │ │ ├── duplicate │ │ │ │ ├── CircuitBreakerService1.java │ │ │ │ ├── CircuitBreakerService2.java │ │ │ │ └── DuplicateCircuitBreakerNameTest.java │ │ │ └── inheritance │ │ │ │ ├── CircuitBreakerNameInheritanceTest.java │ │ │ │ ├── SubCircuitBreakerService.java │ │ │ │ └── SuperCircuitBreakerService.java │ │ ├── rollingwindow │ │ │ └── CircuitBreakerRollingWindowTest.java │ │ └── timer │ │ │ └── halfopen │ │ │ ├── CircuitBreakerTimerHalfOpenTest.java │ │ │ └── HelloService.java │ │ ├── config │ │ ├── better │ │ │ ├── BulkheadConfigBean.java │ │ │ ├── BulkheadConfigTest.java │ │ │ ├── CircuitBreakerConfigBean.java │ │ │ ├── CircuitBreakerConfigTest.java │ │ │ ├── ConfigPropertyBean.java │ │ │ ├── ConfigPropertyGlobalVsClassTest.java │ │ │ ├── ConfigPropertyGlobalVsClassVsMethodTest.java │ │ │ ├── ConfigPropertyOnClassAndMethodTest.java │ │ │ ├── FallbackApplyOnConfigTest.java │ │ │ ├── FallbackConfigBean.java │ │ │ ├── FallbackConfigTest.java │ │ │ ├── FallbackHandlerA.java │ │ │ ├── FallbackHandlerB.java │ │ │ ├── FallbackSkipOnConfigTest.java │ │ │ ├── RateLimitConfigBean.java │ │ │ ├── RateLimitConfigTest.java │ │ │ ├── RetryConfigBean.java │ │ │ ├── RetryConfigTest.java │ │ │ ├── TestConfigExceptionA.java │ │ │ ├── TestConfigExceptionB.java │ │ │ ├── TestConfigExceptionB1.java │ │ │ ├── TestException.java │ │ │ ├── TimeoutConfigBean.java │ │ │ └── TimeoutConfigTest.java │ │ ├── extension │ │ │ ├── CustomExtension.java │ │ │ ├── ExtensionAnnotationTest.java │ │ │ └── UnconfiguredService.java │ │ └── priority │ │ │ ├── ConfigParameterPriorityTest.java │ │ │ └── FaultyService.java │ │ ├── defaultmethod │ │ ├── DefaultMethodTest.java │ │ ├── HelloService.java │ │ ├── InterfaceBased.java │ │ ├── InterfaceBasedExtension.java │ │ ├── RegisterInterfaceBased.java │ │ └── SimpleService.java │ │ ├── fallback │ │ ├── CircuitBreakerWithFallbackTest.java │ │ ├── PingService.java │ │ ├── causechain │ │ │ ├── ExpectedOutcomeException.java │ │ │ ├── FallbackWithApplyOn.java │ │ │ ├── FallbackWithBothSkipOnAndApplyOn.java │ │ │ ├── FallbackWithExceptionCauseChainTest.java │ │ │ └── FallbackWithSkipOn.java │ │ ├── handler │ │ │ └── primitive │ │ │ │ ├── MyIntFallbackHandler.java │ │ │ │ ├── MyService.java │ │ │ │ ├── MyVoidFallbackHandler.java │ │ │ │ └── PrimitiveFallbackHandlerTest.java │ │ ├── retry │ │ │ ├── CircuitBreakerRetryFallbackTest.java │ │ │ ├── SuperCoolService.java │ │ │ └── metrics │ │ │ │ ├── FallbackRetryMetricsTest.java │ │ │ │ └── MyService.java │ │ └── varying │ │ │ ├── HelloService.java │ │ │ └── VaryingFallbackTest.java │ │ ├── fallbackmethod │ │ ├── exception │ │ │ └── param │ │ │ │ ├── BasicService.java │ │ │ │ ├── FallbackMethodExceptionParamTest.java │ │ │ │ ├── GenericInterface.java │ │ │ │ ├── GenericService.java │ │ │ │ ├── GenericSuperclass.java │ │ │ │ ├── MissingService.java │ │ │ │ ├── MixedService.java │ │ │ │ ├── MultipleService.java │ │ │ │ ├── SkipOnService.java │ │ │ │ ├── VarargsService.java │ │ │ │ └── invalid │ │ │ │ ├── InvalidFallbackMethodExceptionParamTest.java │ │ │ │ ├── InvalidService.java │ │ │ │ └── generic │ │ │ │ ├── InvalidGenericFallbackMethodExceptionParamTest.java │ │ │ │ ├── InvalidGenericService.java │ │ │ │ └── InvalidGenericSuperclass.java │ │ ├── nonpublic │ │ │ ├── FaultyService.java │ │ │ └── NonPublicFallbackMethodTest.java │ │ └── parameterized │ │ │ ├── param │ │ │ └── raw │ │ │ │ ├── ParameterizedAndRawFallbackMethod.java │ │ │ │ └── ParameterizedAndRawFallbackMethodTest.java │ │ │ ├── raw │ │ │ └── param │ │ │ │ ├── RawAndParameterizedFallbackMethod.java │ │ │ │ └── RawAndParameterizedFallbackMethodTest.java │ │ │ └── typearg │ │ │ └── mismatch │ │ │ ├── TypeArgumentMismatchFallbackMethod.java │ │ │ └── TypeArgumentMismatchFallbackMethodTest.java │ │ ├── metadata │ │ ├── BaseService.java │ │ ├── HelloService.java │ │ └── RetryOnSubclassOverrideTest.java │ │ ├── programmatic │ │ ├── CdiBulkheadAsyncEventsTest.java │ │ ├── CdiBulkheadAsyncTest.java │ │ ├── CdiBulkheadEventsTest.java │ │ ├── CdiBulkheadTest.java │ │ ├── CdiCircuitBreakerAsyncEventsTest.java │ │ ├── CdiCircuitBreakerAsyncTest.java │ │ ├── CdiCircuitBreakerEventsTest.java │ │ ├── CdiCircuitBreakerMaintenanceTest.java │ │ ├── CdiCircuitBreakerTest.java │ │ ├── CdiFallbackAsyncTest.java │ │ ├── CdiFallbackTest.java │ │ ├── CdiMetricsTest.java │ │ ├── CdiMetricsTimerTest.java │ │ ├── CdiPassthroughAsyncTest.java │ │ ├── CdiPassthroughTest.java │ │ ├── CdiRateLimitAsyncEventsTest.java │ │ ├── CdiRateLimitAsyncTest.java │ │ ├── CdiRateLimitEventsTest.java │ │ ├── CdiRateLimitTest.java │ │ ├── CdiRetryAsyncEventsTest.java │ │ ├── CdiRetryAsyncTest.java │ │ ├── CdiRetryEventsTest.java │ │ ├── CdiRetryTest.java │ │ ├── CdiSkipFaultToleranceTest.java │ │ ├── CdiThreadOffloadTest.java │ │ ├── CdiTimeoutAsyncEventsTest.java │ │ ├── CdiTimeoutAsyncTest.java │ │ ├── CdiTimeoutEventsTest.java │ │ ├── CdiTimeoutTest.java │ │ ├── CdiUntypedAsyncGuardTest.java │ │ └── CdiUntypedGuardTest.java │ │ ├── ratelimit │ │ ├── MyService.java │ │ └── RateLimitTest.java │ │ ├── retry │ │ ├── RetryTest.java │ │ ├── RetryTestBean.java │ │ ├── backoff │ │ │ ├── custom │ │ │ │ ├── CustomBackoffRetryService.java │ │ │ │ ├── CustomBackoffRetryTest.java │ │ │ │ └── TestBackoffStrategy.java │ │ │ ├── error │ │ │ │ ├── ClassAndMethodBackoffService.java │ │ │ │ ├── ClassAndMethodBackoffTest.java │ │ │ │ ├── RetryOnClassBackoffOnMethodService.java │ │ │ │ ├── RetryOnClassBackoffOnMethodTest.java │ │ │ │ ├── RetryOnMethodBackoffOnClassService.java │ │ │ │ ├── RetryOnMethodBackoffOnClassTest.java │ │ │ │ ├── TwoBackoffsOnMethodService.java │ │ │ │ └── TwoBackoffsOnMethodTest.java │ │ │ ├── exponential │ │ │ │ ├── ExponentialBackoffRetryService.java │ │ │ │ ├── ExponentialBackoffRetryTest.java │ │ │ │ ├── config │ │ │ │ │ ├── ConfiguredExponentialBackoffRetryService.java │ │ │ │ │ └── ConfiguredExponentialBackoffRetryTest.java │ │ │ │ └── error │ │ │ │ │ ├── MaxDelayEqualToMaxDurationService.java │ │ │ │ │ ├── MaxDelayEqualToMaxDurationTest.java │ │ │ │ │ ├── MaxDelayGreaterThanMaxDurationService.java │ │ │ │ │ ├── MaxDelayGreaterThanMaxDurationTest.java │ │ │ │ │ ├── NegativeFactorService.java │ │ │ │ │ ├── NegativeFactorTest.java │ │ │ │ │ ├── NegativeMaxDelayService.java │ │ │ │ │ ├── NegativeMaxDelayTest.java │ │ │ │ │ ├── ZeroFactorService.java │ │ │ │ │ └── ZeroFactorTest.java │ │ │ └── fibonacci │ │ │ │ ├── FibonacciBackoffRetryService.java │ │ │ │ ├── FibonacciBackoffRetryTest.java │ │ │ │ └── error │ │ │ │ ├── MaxDelayEqualToMaxDurationService.java │ │ │ │ ├── MaxDelayEqualToMaxDurationTest.java │ │ │ │ ├── MaxDelayGreaterThanMaxDurationService.java │ │ │ │ ├── MaxDelayGreaterThanMaxDurationTest.java │ │ │ │ ├── NegativeMaxDelayService.java │ │ │ │ └── NegativeMaxDelayTest.java │ │ ├── beforeretry │ │ │ ├── BeforeRetryHandlerService.java │ │ │ ├── BeforeRetryHandlerTest.java │ │ │ ├── BeforeRetryMethodService.java │ │ │ ├── BeforeRetryMethodTest.java │ │ │ ├── MyDependency.java │ │ │ └── error │ │ │ │ ├── BothValueAndMethodNameSetService.java │ │ │ │ ├── BothValueAndMethodNameSetTest.java │ │ │ │ ├── NoBeforeRetryMethodFoundService.java │ │ │ │ ├── NoBeforeRetryMethodFoundTest.java │ │ │ │ ├── RetryOnClassBeforeRetryOnMethodService.java │ │ │ │ ├── RetryOnClassBeforeRetryOnMethodTest.java │ │ │ │ ├── RetryOnMethodBeforeRetryOnClassService.java │ │ │ │ └── RetryOnMethodBeforeRetryOnClassTest.java │ │ ├── stackoverflow │ │ │ ├── MyService.java │ │ │ └── RetryStackOverflowTest.java │ │ └── when │ │ │ ├── IsIllegalArgumentException.java │ │ │ ├── IsNull.java │ │ │ ├── both │ │ │ ├── RetryWhenResultAndExceptionService.java │ │ │ └── RetryWhenResultAndExceptionTest.java │ │ │ ├── error │ │ │ ├── RetryOnAndRetryWhenExceptionService.java │ │ │ ├── RetryOnAndRetryWhenExceptionTest.java │ │ │ ├── RetryOnClassRetryWhenOnMethodService.java │ │ │ ├── RetryOnClassRetryWhenOnMethodTest.java │ │ │ ├── RetryOnMethodRetryWhenOnClassService.java │ │ │ └── RetryOnMethodRetryWhenOnClassTest.java │ │ │ ├── exception │ │ │ ├── RetryWhenExceptionDoesNotMatchService.java │ │ │ ├── RetryWhenExceptionMatchesService.java │ │ │ └── RetryWhenExceptionTest.java │ │ │ └── result │ │ │ ├── RetryWhenResultDoesNotMatchService.java │ │ │ ├── RetryWhenResultMatchesService.java │ │ │ └── RetryWhenResultTest.java │ │ ├── retryonerror │ │ ├── HelloService.java │ │ └── RetryOnErrorTest.java │ │ ├── reuse │ │ ├── async │ │ │ ├── completionstage │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ ├── MyService.java │ │ │ │ ├── ReuseAsyncCompletionStageTest.java │ │ │ │ ├── fallback │ │ │ │ │ ├── guard │ │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ │ ├── MyService.java │ │ │ │ │ │ └── ReuseAsyncCompletionStageFallbackGuardTest.java │ │ │ │ │ └── typedguard │ │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ │ ├── MyService.java │ │ │ │ │ │ └── ReuseAsyncCompletionStageFallbackTypedGuardTest.java │ │ │ │ ├── metrics │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ └── ReuseAsyncCompletionStageMetricsTest.java │ │ │ │ └── threadoffload │ │ │ │ │ ├── guard │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ └── ReuseAsyncCompletionStageThreadOffloadGuardTest.java │ │ │ │ │ └── typedguard │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ └── ReuseAsyncCompletionStageThreadOffloadTypedGuardTest.java │ │ │ └── uni │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ ├── MyService.java │ │ │ │ ├── ReuseAsyncUniTest.java │ │ │ │ ├── fallback │ │ │ │ ├── guard │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ └── ReuseAsyncUniFallbackGuardTest.java │ │ │ │ └── typedguard │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ └── ReuseAsyncUniFallbackTypedGuardTest.java │ │ │ │ ├── metrics │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ ├── MyService.java │ │ │ │ └── ReuseAsyncUniMetricsTest.java │ │ │ │ └── threadoffload │ │ │ │ ├── guard │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ ├── MyService.java │ │ │ │ └── ReuseAsyncUniThreadOffloadGuardTest.java │ │ │ │ └── typedguard │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ ├── MyService.java │ │ │ │ └── ReuseAsyncUniThreadOffloadTypedGuardTest.java │ │ ├── config │ │ │ ├── guard │ │ │ │ ├── bulkhead │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ ├── ReuseGuardConfigBulkheadTest.java │ │ │ │ │ └── disable │ │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ │ ├── MyService.java │ │ │ │ │ │ └── ReuseGuardConfigBulkheadDisableTest.java │ │ │ │ ├── circuit │ │ │ │ │ └── breaker │ │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ │ ├── MyService.java │ │ │ │ │ │ ├── ReuseGuardConfigCircuitBreakerTest.java │ │ │ │ │ │ └── disable │ │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ │ ├── MyService.java │ │ │ │ │ │ └── ReuseGuardConfigCircuitBreakerDisableTest.java │ │ │ │ ├── invalid │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ └── ReuseGuardConfigInvalidTest.java │ │ │ │ ├── ratelimit │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ ├── ReuseGuardConfigRateLimitTest.java │ │ │ │ │ └── disable │ │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ │ ├── MyService.java │ │ │ │ │ │ └── ReuseGuardConfigRateLimitDisableTest.java │ │ │ │ ├── retry │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ ├── ReuseGuardConfigRetryTest.java │ │ │ │ │ └── disable │ │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ │ ├── MyService.java │ │ │ │ │ │ └── ReuseGuardConfigRetryDisableTest.java │ │ │ │ └── timeout │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ ├── ReuseGuardConfigTimeoutTest.java │ │ │ │ │ └── disable │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ └── ReuseGuardConfigTimeoutDisableTest.java │ │ │ └── typedguard │ │ │ │ ├── invalid │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ ├── MyService.java │ │ │ │ └── ReuseTypedGuardConfigInvalidTest.java │ │ │ │ └── retry │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ ├── MyService.java │ │ │ │ ├── ReuseTypedGuardConfigRetryTest.java │ │ │ │ └── disable │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ ├── MyService.java │ │ │ │ └── ReuseTypedGuardConfigRetryDisableTest.java │ │ ├── errors │ │ │ ├── GuardWithIdentifierGlobalProducer.java │ │ │ ├── GuardWithIdentifierGlobalTest.java │ │ │ ├── MultipleGuardsWithSameIdentifierProducer.java │ │ │ ├── MultipleGuardsWithSameIdentifierTest.java │ │ │ ├── ReuseMissingService.java │ │ │ ├── ReuseMissingTest.java │ │ │ ├── TypedGuardWithIdentifierGlobalProducer.java │ │ │ └── TypedGuardWithIdentifierGlobalTest.java │ │ ├── mixed │ │ │ ├── all │ │ │ │ ├── MixedReuseAllTest.java │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ ├── MyService.java │ │ │ │ ├── fallback │ │ │ │ │ ├── MixedReuseAllFallbackTest.java │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ └── MyService.java │ │ │ │ └── metrics │ │ │ │ │ ├── MixedReuseAllMetricsTest.java │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ └── MyService.java │ │ │ ├── async │ │ │ │ ├── both │ │ │ │ │ ├── MixedReuseAsyncBothTest.java │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ ├── fallback │ │ │ │ │ │ ├── MixedReuseAsyncBothFallbackTest.java │ │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ │ └── MyService.java │ │ │ │ │ └── threadoffload │ │ │ │ │ │ ├── MixedReuseAsyncBothThreadOffloadTest.java │ │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ │ └── MyService.java │ │ │ │ ├── completionstage │ │ │ │ │ ├── MixedReuseAsyncCompletionStageTest.java │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ ├── fallback │ │ │ │ │ │ ├── MixedReuseAsyncCompletionStageFallbackTest.java │ │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ │ └── MyService.java │ │ │ │ │ └── threadoffload │ │ │ │ │ │ ├── MixedReuseAsyncCompletionStageThreadOffloadTest.java │ │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ │ └── MyService.java │ │ │ │ └── uni │ │ │ │ │ ├── MixedReuseAsyncUniTest.java │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ ├── MyService.java │ │ │ │ │ ├── fallback │ │ │ │ │ ├── MixedReuseAsyncUniFallbackTest.java │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ └── MyService.java │ │ │ │ │ └── threadoffload │ │ │ │ │ ├── MixedReuseAsyncUniThreadOffloadTest.java │ │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ │ └── MyService.java │ │ │ ├── bulkhead │ │ │ │ ├── MixedReuseBulkheadTest.java │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ └── MyService.java │ │ │ └── sync │ │ │ │ ├── MixedReuseSyncTest.java │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ ├── MyService.java │ │ │ │ ├── fallback │ │ │ │ ├── MixedReuseSyncFallbackTest.java │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ └── MyService.java │ │ │ │ └── threadoffload │ │ │ │ ├── MixedReuseSyncThreadOffloadTest.java │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ └── MyService.java │ │ └── sync │ │ │ ├── MyFaultTolerance.java │ │ │ ├── MyService.java │ │ │ ├── ReuseSyncTest.java │ │ │ ├── fallback │ │ │ ├── guard │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ ├── MyService.java │ │ │ │ └── ReuseSyncFallbackGuardTest.java │ │ │ └── typedguard │ │ │ │ ├── MyFaultTolerance.java │ │ │ │ ├── MyService.java │ │ │ │ └── ReuseSyncFallbackTypedGuardTest.java │ │ │ ├── metrics │ │ │ ├── MyFaultTolerance.java │ │ │ ├── MyService.java │ │ │ └── ReuseSyncMetricsTest.java │ │ │ └── threadoffload │ │ │ ├── guard │ │ │ ├── MyFaultTolerance.java │ │ │ ├── MyService.java │ │ │ └── ReuseSyncThreadOffloadGuardTest.java │ │ │ └── typedguard │ │ │ ├── MyFaultTolerance.java │ │ │ ├── MyService.java │ │ │ └── ReuseSyncThreadOffloadTypedGuardTest.java │ │ ├── timeout │ │ ├── TimeoutTest.java │ │ └── TimingOutService.java │ │ └── util │ │ ├── ExpectedDeploymentException.java │ │ ├── FaultToleranceBasicTest.java │ │ ├── ResetSmallRyeMetricsExtension.java │ │ ├── WeldWithFaultToleranceExtension.java │ │ ├── WithSystemProperty.java │ │ └── WithSystemPropertyExtension.java │ ├── kotlin │ └── io │ │ └── smallrye │ │ └── faulttolerance │ │ └── kotlin │ │ ├── bulkhead │ │ ├── KotlinBulkheadTest.kt │ │ └── MyService.kt │ │ ├── circuitbreaker │ │ ├── KotlinCircuitBreakerTest.kt │ │ └── MyService.kt │ │ ├── fallback │ │ ├── KotlinFallbackTest.kt │ │ ├── MyService.kt │ │ └── invalid │ │ │ ├── KotlinInvalidFallbackTest.kt │ │ │ └── MyService.kt │ │ ├── ratelimit │ │ ├── KotlinRateLimitTest.kt │ │ └── MyService.kt │ │ ├── retry │ │ ├── KotlinRetryTest.kt │ │ └── MyService.kt │ │ ├── reuse │ │ ├── MyFaultTolerance.kt │ │ ├── MyService.kt │ │ ├── ReuseKotlinTest.kt │ │ ├── fallback │ │ │ ├── guard │ │ │ │ ├── MyFaultTolerance.kt │ │ │ │ ├── MyService.kt │ │ │ │ └── ReuseKotlinFallbackGuardTest.kt │ │ │ └── typedguard │ │ │ │ ├── MyFaultTolerance.kt │ │ │ │ ├── MyService.kt │ │ │ │ └── ReuseKotlinFallbackTypedGuardTest.kt │ │ └── metrics │ │ │ ├── MyFaultTolerance.kt │ │ │ ├── MyService.kt │ │ │ └── ReuseKotlinMetricsTest.kt │ │ └── timeout │ │ ├── KotlinTimeoutTest.kt │ │ └── MyService.kt │ └── resources │ └── logging.properties ├── integration ├── pom.xml └── src │ └── test │ ├── java │ └── io │ │ └── smallrye │ │ └── faulttolerance │ │ ├── TestAsyncExecutorProvider.java │ │ ├── async │ │ └── requestcontext │ │ │ ├── AsyncService.java │ │ │ ├── AsynchronousRequestContextTest.java │ │ │ └── RequestFoo.java │ │ ├── tracing │ │ ├── Service.java │ │ ├── TracingContextPropagationTest.java │ │ └── stress │ │ │ ├── Service.java │ │ │ └── TracingContextPropagationStressTest.java │ │ ├── util │ │ └── FaultToleranceIntegrationTest.java │ │ └── vertx │ │ ├── AbstractVertxTest.java │ │ ├── ContextDescription.java │ │ ├── ExecutionStyle.java │ │ ├── VertxContext.java │ │ ├── async │ │ ├── AsyncOnVertxThreadTest.java │ │ └── MyService.java │ │ ├── bulkhead │ │ ├── AsyncBulkheadOnVertxThreadTest.java │ │ ├── MyService.java │ │ └── retry │ │ │ ├── AsyncBulkheadRetryOnVertxThreadTest.java │ │ │ └── MyService.java │ │ ├── retry │ │ ├── AsyncRetryOnVertxThreadTest.java │ │ ├── MyService.java │ │ ├── fallback │ │ │ ├── AsyncRetryFallbackOnVertxThreadTest.java │ │ │ └── MyService.java │ │ └── requestcontext │ │ │ ├── AsyncRetryWithRequestContextOnVertxThreadTest.java │ │ │ ├── MyRequestScopedService.java │ │ │ └── MyService.java │ │ └── timeout │ │ ├── AsyncTimeoutOnVertxThreadTest.java │ │ └── MyService.java │ └── resources │ └── logging.properties ├── pom.xml └── tck ├── pom.xml └── src └── test ├── java └── io │ └── smallrye │ └── faulttolerance │ └── tck │ ├── CleanupMetricRegistries.java │ ├── FaultToleranceApplicationArchiveProcessor.java │ ├── FaultToleranceExtension.java │ ├── ForceOtelBean.java │ ├── LoggingTestListener.java │ ├── OtelConfigExtension.java │ ├── RetryTckOnMac.java │ └── TckDeploymentExceptionTransformer.java ├── resources ├── META-INF │ └── services │ │ ├── jakarta.enterprise.inject.spi.Extension │ │ └── org.jboss.arquillian.core.spi.LoadableExtension └── logging.properties ├── tck-suite-non-compatible.xml └── tck-suite.xml /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | end_of_line = lf 11 | insert_final_newline = true 12 | 13 | ij_continuation_indent_size = 8 14 | ij_any_align_multiline_parameters = false 15 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: maven 4 | directory: / 5 | schedule: 6 | interval: daily 7 | - package-ecosystem: github-actions 8 | directory: / 9 | schedule: 10 | interval: daily 11 | -------------------------------------------------------------------------------- /.github/project.yml: -------------------------------------------------------------------------------- 1 | name: SmallRye Fault Tolerance 2 | release: 3 | current-version: 6.9.1 4 | next-version: 6.9.2-SNAPSHOT 5 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | .github @smallrye/fault-tolerance 2 | -------------------------------------------------------------------------------- /api/src/main/java/io/smallrye/faulttolerance/api/AlwaysOnException.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.api; 2 | 3 | import java.util.function.Predicate; 4 | 5 | public final class AlwaysOnException implements Predicate { 6 | @Override 7 | public boolean test(Throwable ignored) { 8 | return true; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /api/src/main/java/io/smallrye/faulttolerance/api/NeverOnResult.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.api; 2 | 3 | import java.util.function.Predicate; 4 | 5 | public final class NeverOnResult implements Predicate { 6 | @Override 7 | public boolean test(Object ignored) { 8 | return false; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /doc/antora-playbook.yml: -------------------------------------------------------------------------------- 1 | # partial playbook just for this project to be able to compile documentation without pushing it to GitHub 2 | # usage: antora generate antora-playbook.yml 3 | site: 4 | title: SmallRye Fault Tolerance only documentation 5 | start_page: smallrye-fault-tolerance::index.adoc 6 | content: 7 | sources: 8 | - url: .. 9 | start_path: doc 10 | branches: HEAD 11 | ui: 12 | bundle: 13 | url: https://github.com/smallrye/smallrye-antora-ui/blob/main/build/ui-bundle.zip?raw=true 14 | snapshot: true 15 | asciidoc: 16 | extensions: 17 | - asciidoctor-kroki 18 | attributes: 19 | page-pagination: '' 20 | kroki-fetch-diagram: true 21 | -------------------------------------------------------------------------------- /doc/antora.yml: -------------------------------------------------------------------------------- 1 | name: smallrye-fault-tolerance 2 | title: SmallRye Fault Tolerance 3 | version: main 4 | nav: 5 | - modules/ROOT/nav.adoc 6 | 7 | asciidoc: 8 | attributes: 9 | smallrye-fault-tolerance: SmallRye Fault Tolerance 10 | smallrye-fault-tolerance-version: '6.9.1' 11 | 12 | microprofile-fault-tolerance: MicroProfile Fault Tolerance 13 | microprofile-fault-tolerance-version: '4.1.2' 14 | microprofile-fault-tolerance-url: https://download.eclipse.org/microprofile/microprofile-fault-tolerance-4.1/microprofile-fault-tolerance-spec-4.1.html 15 | 16 | vertx4-version: '4.5.8' 17 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/howto/timeout.adoc: -------------------------------------------------------------------------------- 1 | = How to Watch for Timeouts 2 | 3 | It is possible to prevent an operation from taking too long using a _timeout_. 4 | 5 | == `@Timeout` 6 | 7 | The `@Timeout` annotation specifies that all calls of the method should fail if they take too long. 8 | 9 | [source,java] 10 | ---- 11 | @ApplicationScoped 12 | public class MyService { 13 | @Timeout // <1> 14 | public String hello() { 15 | ... 16 | } 17 | } 18 | ---- 19 | <1> Declares that `hello()` must not take too long. 20 | Since there is no configuration, the default is at most 1 second. 21 | 22 | If the method call takes too long, the caller will get a `TimeoutException` instead. 23 | 24 | == Links 25 | 26 | For more information, see xref:reference/timeout.adoc[the Timeout reference guide]. 27 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/integration/async-types.adoc: -------------------------------------------------------------------------------- 1 | = Additional Asynchronous Types Integration Concerns 2 | 3 | This page describes integration concerns for xref:reference/asynchronous.adoc#async-types[Additional Asynchronous Types]. 4 | 5 | To enable support of additional asynchronous types, it is required that the support library is present. 6 | That is: 7 | 8 | * https://smallrye.io/smallrye-mutiny/[Mutiny]: `io.smallrye:smallrye-fault-tolerance-mutiny` 9 | * https://github.com/ReactiveX/RxJava/tree/3.x[RxJava 3]: `io.smallrye:smallrye-fault-tolerance-rxjava3` 10 | 11 | These libraries include some service providers that {smallrye-fault-tolerance} will automatically load and use. 12 | Therefore, no more integration is necessary. 13 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/integration/context-propagation.adoc: -------------------------------------------------------------------------------- 1 | = Context Propagation 2 | 3 | {smallrye-fault-tolerance} supports MicroProfile Context Propagation for `@Asynchronous` method invocations, if 2 conditions are satisfied: 4 | 5 | - the integrator provides a MicroProfile Context Propagation enabled thread pool (see xref:integration/thread-pool.adoc[Thread Pool]); 6 | - the `io.smallrye:smallrye-fault-tolerance-context-propagation` artifact is present (it provides alternative implementations of some internal services, loaded using `ServiceLoader`). 7 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/integration/kotlin.adoc: -------------------------------------------------------------------------------- 1 | = Kotlin Integration Concerns 2 | 3 | This page describes integration concerns for xref:reference/asynchronous.adoc#kotlin-suspend-functions[Kotlin `suspend` functions]. 4 | 5 | To enable support of Kotlin suspending functions, it is required that the support library is present. 6 | Its coordinates are: `io.smallrye:smallrye-fault-tolerance-kotlin`. 7 | 8 | This library includes some service providers that {smallrye-fault-tolerance} will automatically load and use. 9 | Therefore, no more integration is necessary. 10 | -------------------------------------------------------------------------------- /doc/modules/ROOT/pages/internals/instructions.adoc: -------------------------------------------------------------------------------- 1 | = Instructions 2 | 3 | To compile this project and install the artifacts into local Maven repository, run: 4 | 5 | [source,bash] 6 | ---- 7 | mvn clean install 8 | ---- 9 | 10 | This will also run all the tests and the TCK. 11 | 12 | You can use 13 | 14 | [source,bash] 15 | ---- 16 | mvn clean install -DskipTests 17 | ---- 18 | 19 | to skip the tests and make the build a lot faster. 20 | -------------------------------------------------------------------------------- /doc/modules/ROOT/partials/internals.adoc: -------------------------------------------------------------------------------- 1 | WARNING: Note that everything explained here is an implementation detail. 2 | API stability for these interfaces and classes is _not_ guaranteed! 3 | This documentation is only present to provide implementation insight for people who have to debug issues or want to contribute. 4 | -------------------------------------------------------------------------------- /doc/modules/ROOT/partials/non-compat.adoc: -------------------------------------------------------------------------------- 1 | IMPORTANT: This feature only works in the xref:reference/non-compat.adoc[non-compatible mode]. 2 | -------------------------------------------------------------------------------- /doc/modules/ROOT/partials/srye-feature.adoc: -------------------------------------------------------------------------------- 1 | IMPORTANT: This is an additional feature of {smallrye-fault-tolerance} and is not specified by {microprofile-fault-tolerance}. 2 | -------------------------------------------------------------------------------- /doc/modules/ROOT/partials/time-unit-inconsistency.adoc: -------------------------------------------------------------------------------- 1 | NOTE: Note the naming inconsistency between `{time-value-name}` and `{time-unit-bad-name}`. 2 | It is common for the time unit property to be named after the time value property, e.g. `{time-unit-good-name}`. 3 | Fixing this inconsistency would be a breaking change the {microprofile-fault-tolerance} specification is not willing to make. 4 | -------------------------------------------------------------------------------- /implementation/apiimpl/src/main/java/io/smallrye/faulttolerance/apiimpl/BuilderEagerDependencies.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.apiimpl; 2 | 3 | // dependencies that may be accessed eagerly; these must be safe to use during static initialization 4 | public interface BuilderEagerDependencies { 5 | BasicCircuitBreakerMaintenanceImpl cbMaintenance(); 6 | } 7 | -------------------------------------------------------------------------------- /implementation/apiimpl/src/main/java/io/smallrye/faulttolerance/apiimpl/BuilderLazyDependencies.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.apiimpl; 2 | 3 | import java.util.concurrent.ExecutorService; 4 | 5 | import io.smallrye.faulttolerance.core.event.loop.EventLoop; 6 | import io.smallrye.faulttolerance.core.metrics.MetricsProvider; 7 | import io.smallrye.faulttolerance.core.timer.Timer; 8 | 9 | // dependencies that must NOT be accessed eagerly; these are NOT safe to use during static initialization 10 | public interface BuilderLazyDependencies { 11 | boolean ftEnabled(); 12 | 13 | ExecutorService asyncExecutor(); 14 | 15 | EventLoop eventLoop(); 16 | 17 | Timer timer(); 18 | 19 | MetricsProvider metricsProvider(); 20 | } 21 | -------------------------------------------------------------------------------- /implementation/apiimpl/src/main/java/io/smallrye/faulttolerance/basicconfig/ExponentialBackoffConfig.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.basicconfig; 2 | 3 | import io.smallrye.faulttolerance.api.ExponentialBackoff; 4 | import io.smallrye.faulttolerance.autoconfig.AutoConfig; 5 | import io.smallrye.faulttolerance.autoconfig.Config; 6 | 7 | @AutoConfig 8 | public interface ExponentialBackoffConfig extends ExponentialBackoff, Config { 9 | @Override 10 | default void validate() { 11 | if (factor() < 1) { 12 | throw fail("factor", "shouldn't be lower than 1"); 13 | } 14 | if (maxDelay() < 0) { 15 | throw fail("maxDelay", "shouldn't be lower than 0"); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /implementation/apiimpl/src/main/java/io/smallrye/faulttolerance/basicconfig/FibonacciBackoffConfig.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.basicconfig; 2 | 3 | import io.smallrye.faulttolerance.api.FibonacciBackoff; 4 | import io.smallrye.faulttolerance.autoconfig.AutoConfig; 5 | import io.smallrye.faulttolerance.autoconfig.Config; 6 | 7 | @AutoConfig 8 | public interface FibonacciBackoffConfig extends FibonacciBackoff, Config { 9 | @Override 10 | default void validate() { 11 | if (maxDelay() < 0) { 12 | throw fail("maxDelay", "shouldn't be lower than 0"); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /implementation/apiimpl/src/main/java/io/smallrye/faulttolerance/basicconfig/RateLimitConfig.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.basicconfig; 2 | 3 | import io.smallrye.faulttolerance.api.RateLimit; 4 | import io.smallrye.faulttolerance.autoconfig.AutoConfig; 5 | import io.smallrye.faulttolerance.autoconfig.Config; 6 | 7 | @AutoConfig 8 | public interface RateLimitConfig extends RateLimit, Config { 9 | @Override 10 | default void validate() { 11 | if (value() < 1) { 12 | throw fail("value", "shouldn't be lower than 1"); 13 | } 14 | if (window() < 1) { 15 | throw fail("window", "shouldn't be lower than 1"); 16 | } 17 | if (minSpacing() < 0) { 18 | throw fail("minSpacing", "shouldn't be lower than 0"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /implementation/apiimpl/src/main/java/io/smallrye/faulttolerance/basicconfig/TimeoutConfig.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.basicconfig; 2 | 3 | import org.eclipse.microprofile.faulttolerance.Timeout; 4 | 5 | import io.smallrye.faulttolerance.autoconfig.AutoConfig; 6 | import io.smallrye.faulttolerance.autoconfig.Config; 7 | 8 | @AutoConfig 9 | public interface TimeoutConfig extends Timeout, Config { 10 | @Override 11 | default void validate() { 12 | if (value() < 0) { 13 | throw fail("value", "shouldn't be lower than 0"); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /implementation/autoconfig/core/src/main/java/io/smallrye/faulttolerance/autoconfig/ConfigConstants.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.autoconfig; 2 | 3 | public class ConfigConstants { 4 | public static final String PREFIX = "smallrye.faulttolerance."; 5 | 6 | public static final String ENABLED = "enabled"; 7 | public static final String GLOBAL = "global"; 8 | } 9 | -------------------------------------------------------------------------------- /implementation/autoconfig/core/src/main/java/io/smallrye/faulttolerance/autoconfig/KotlinSupport.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.autoconfig; 2 | 3 | // TODO this would ideally live in the `kotlin` module 4 | final class KotlinSupport { 5 | private static final String KOTLIN_CONTINUATION = "kotlin.coroutines.Continuation"; 6 | 7 | static boolean isLegitimate(MethodDescriptor method) { 8 | if (method.parameterTypes.length > 0 9 | && method.parameterTypes[method.parameterTypes.length - 1].getName().equals(KOTLIN_CONTINUATION) 10 | && method.name.endsWith("$suspendImpl")) { 11 | return false; 12 | } 13 | return true; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /implementation/autoconfig/processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.autoconfig.processor.AutoConfigProcessor -------------------------------------------------------------------------------- /implementation/context-propagation/src/main/java/io/smallrye/faulttolerance/propagation/ContextPropagationRunnableWrapper.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.propagation; 2 | 3 | import org.eclipse.microprofile.context.ThreadContext; 4 | 5 | import io.smallrye.faulttolerance.core.util.RunnableWrapper; 6 | 7 | public class ContextPropagationRunnableWrapper implements RunnableWrapper { 8 | private final ThreadContext threadContext = ThreadContext.builder().build(); 9 | 10 | @Override 11 | public Runnable wrap(Runnable runnable) { 12 | return threadContext.contextualRunnable(runnable); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /implementation/context-propagation/src/main/resources/META-INF/services/io.smallrye.faulttolerance.core.util.RunnableWrapper: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.propagation.ContextPropagationRunnableWrapper -------------------------------------------------------------------------------- /implementation/context-propagation/src/main/resources/META-INF/services/io.smallrye.faulttolerance.internal.RequestContextControllerProvider: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.propagation.ContextPropagationRequestContextControllerProvider -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/CoreLogger.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | 5 | import org.jboss.logging.BasicLogger; 6 | import org.jboss.logging.Logger; 7 | import org.jboss.logging.annotations.MessageLogger; 8 | 9 | @MessageLogger(projectCode = "SRFTL", length = 5) 10 | interface CoreLogger extends BasicLogger { 11 | CoreLogger LOG = Logger.getMessageLogger(MethodHandles.lookup(), CoreLogger.class, CoreLogger.class.getPackage().getName()); 12 | } 13 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/FailureContext.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core; 2 | 3 | import static io.smallrye.faulttolerance.core.util.Preconditions.checkNotNull; 4 | 5 | public final class FailureContext { 6 | public final Throwable failure; 7 | public final FaultToleranceContext context; 8 | 9 | public FailureContext(Throwable failure, FaultToleranceContext context) { 10 | this.failure = checkNotNull(failure, "failure must be set"); 11 | this.context = checkNotNull(context, "context must be set"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/FaultToleranceEvent.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core; 2 | 3 | public interface FaultToleranceEvent { 4 | } 5 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/async/AsyncLogger.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.async; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | 5 | import org.jboss.logging.BasicLogger; 6 | import org.jboss.logging.Logger; 7 | import org.jboss.logging.annotations.MessageLogger; 8 | 9 | @MessageLogger(projectCode = "SRFTL", length = 5) 10 | interface AsyncLogger extends BasicLogger { 11 | AsyncLogger LOG = Logger.getMessageLogger(MethodHandles.lookup(), AsyncLogger.class, 12 | AsyncLogger.class.getPackage().getName()); 13 | } 14 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/async/FutureCancellationEvent.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.async; 2 | 3 | import io.smallrye.faulttolerance.core.FaultToleranceEvent; 4 | 5 | public enum FutureCancellationEvent implements FaultToleranceEvent { 6 | INTERRUPTIBLE(true), 7 | NONINTERRUPTIBLE(false); 8 | 9 | public final boolean interruptible; 10 | 11 | FutureCancellationEvent(boolean interruptible) { 12 | this.interruptible = interruptible; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/async/ThreadOffloadEnabled.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.async; 2 | 3 | public final class ThreadOffloadEnabled { 4 | public final boolean value; 5 | 6 | public ThreadOffloadEnabled(boolean value) { 7 | this.value = value; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/circuit/breaker/RollingWindow.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.circuit.breaker; 2 | 3 | public interface RollingWindow { 4 | /** 5 | * Records a successful invocation 6 | * 7 | * @return whether the failure threshold has been reached 8 | */ 9 | boolean recordSuccess(); 10 | 11 | /** 12 | * Records a failed invocation 13 | * 14 | * @return whether the failure threshold has been reached 15 | */ 16 | boolean recordFailure(); 17 | 18 | static RollingWindow create(int size, int failureThreshold) { 19 | return new BitsetRollingWindow(size, failureThreshold); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/event/loop/NoEventLoop.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.event.loop; 2 | 3 | import java.util.concurrent.Executor; 4 | 5 | final class NoEventLoop implements EventLoop { 6 | static final NoEventLoop INSTANCE = new NoEventLoop(); 7 | 8 | private NoEventLoop() { 9 | // avoid instantiation 10 | } 11 | 12 | @Override 13 | public Executor executor() { 14 | return null; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/fallback/FallbackEvents.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.fallback; 2 | 3 | import io.smallrye.faulttolerance.core.FaultToleranceEvent; 4 | 5 | public class FallbackEvents { 6 | public enum Defined implements FaultToleranceEvent { 7 | INSTANCE 8 | } 9 | 10 | public enum Applied implements FaultToleranceEvent { 11 | INSTANCE 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/fallback/FallbackFunction.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.fallback; 2 | 3 | import java.util.function.Function; 4 | 5 | import io.smallrye.faulttolerance.core.FailureContext; 6 | import io.smallrye.faulttolerance.core.Future; 7 | 8 | @FunctionalInterface 9 | public interface FallbackFunction extends Function> { 10 | FallbackFunction IGNORE = ignored -> { 11 | throw new UnsupportedOperationException(); 12 | }; 13 | 14 | static FallbackFunction ignore() { 15 | return (FallbackFunction) IGNORE; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/fallback/FallbackLogger.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.fallback; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | 5 | import org.jboss.logging.BasicLogger; 6 | import org.jboss.logging.Logger; 7 | import org.jboss.logging.annotations.MessageLogger; 8 | 9 | @MessageLogger(projectCode = "SRFTL", length = 5) 10 | interface FallbackLogger extends BasicLogger { 11 | FallbackLogger LOG = Logger.getMessageLogger(MethodHandles.lookup(), FallbackLogger.class, 12 | FallbackLogger.class.getPackage().getName()); 13 | } 14 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/invocation/AsyncSupport.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.invocation; 2 | 3 | import io.smallrye.faulttolerance.core.Future; 4 | 5 | // V = value type, e.g. String 6 | // AT = async type that eventually produces V, e.g. CompletionStage or Uni 7 | public interface AsyncSupport { 8 | String mustDescription(); 9 | 10 | String doesDescription(); 11 | 12 | boolean applies(Class[] parameterTypes, Class returnType); 13 | 14 | AT createComplete(V value); 15 | 16 | Future toFuture(Invoker invoker); 17 | 18 | AT fromFuture(Invoker> invoker); 19 | } 20 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/invocation/Invoker.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.invocation; 2 | 3 | import java.util.function.Function; 4 | 5 | public interface Invoker { 6 | int parametersCount(); 7 | 8 | T getArgument(int index, Class parameterType); 9 | 10 | // callers should think about restoring the original argument later, if necessary 11 | T replaceArgument(int index, Class parameterType, Function transformation); 12 | 13 | V proceed() throws Exception; 14 | } 15 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/metrics/GeneralMetricsEvents.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.metrics; 2 | 3 | import io.smallrye.faulttolerance.core.FaultToleranceEvent; 4 | 5 | public class GeneralMetricsEvents { 6 | public enum ExecutionFinished implements FaultToleranceEvent { 7 | VALUE_RETURNED(true), 8 | EXCEPTION_THROWN(false), 9 | ; 10 | 11 | public final boolean succeeded; 12 | 13 | ExecutionFinished(boolean succeeded) { 14 | this.succeeded = succeeded; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/metrics/MeteredOperation.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.metrics; 2 | 3 | public interface MeteredOperation { 4 | boolean enabled(); 5 | 6 | boolean mayBeAsynchronous(); 7 | 8 | boolean hasBulkhead(); 9 | 10 | boolean hasCircuitBreaker(); 11 | 12 | boolean hasFallback(); 13 | 14 | boolean hasRateLimit(); 15 | 16 | boolean hasRetry(); 17 | 18 | boolean hasTimeout(); 19 | 20 | String name(); 21 | 22 | Object cacheKey(); 23 | } 24 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/metrics/MeteredOperationName.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.metrics; 2 | 3 | public final class MeteredOperationName { 4 | private final String name; 5 | 6 | public MeteredOperationName(String name) { 7 | this.name = name; 8 | } 9 | 10 | public String get() { 11 | return name; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/metrics/MetricsLogger.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.metrics; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | 5 | import org.jboss.logging.BasicLogger; 6 | import org.jboss.logging.Logger; 7 | import org.jboss.logging.annotations.MessageLogger; 8 | 9 | @MessageLogger(projectCode = "SRFTL", length = 5) 10 | interface MetricsLogger extends BasicLogger { 11 | MetricsLogger LOG = Logger.getMessageLogger(MethodHandles.lookup(), MetricsLogger.class, 12 | MetricsLogger.class.getPackage().getName()); 13 | } 14 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/metrics/MetricsProvider.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.metrics; 2 | 3 | public interface MetricsProvider { 4 | boolean isEnabled(); 5 | 6 | MetricsRecorder create(MeteredOperation operation); 7 | } 8 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Core implementations of fault tolerance strategies conforming to MicroProfile Fault Tolerance. 3 | * The strategies here are not meant to be used directly. 4 | * Their API is not optimized for end user friendliness, but for integration correctness. 5 | * The core abstraction is {@link io.smallrye.faulttolerance.core.FaultToleranceStrategy}; each strategy implements that. 6 | * API stability in this package and all its subpackages is not guaranteed! 7 | */ 8 | package io.smallrye.faulttolerance.core; 9 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/rate/limit/RateLimitEvents.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.rate.limit; 2 | 3 | import io.smallrye.faulttolerance.core.FaultToleranceEvent; 4 | 5 | public class RateLimitEvents { 6 | public enum DecisionMade implements FaultToleranceEvent { 7 | PERMITTED(true), 8 | REJECTED(false), 9 | ; 10 | 11 | public final boolean permitted; 12 | 13 | DecisionMade(boolean permitted) { 14 | this.permitted = permitted; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/rate/limit/RateLimitLogger.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.rate.limit; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | 5 | import org.jboss.logging.BasicLogger; 6 | import org.jboss.logging.Logger; 7 | import org.jboss.logging.annotations.MessageLogger; 8 | 9 | @MessageLogger(projectCode = "SRFTL", length = 5) 10 | interface RateLimitLogger extends BasicLogger { 11 | RateLimitLogger LOG = Logger.getMessageLogger(MethodHandles.lookup(), RateLimitLogger.class, 12 | RateLimitLogger.class.getPackage().getName()); 13 | } 14 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/retry/BackOff.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.retry; 2 | 3 | /** 4 | * Computes the delay value. 5 | *

6 | * For each invocation of the retry strategy, one instance is obtained and used for computing all delay values. 7 | * This instance may be used from multiple threads, but is not used concurrently. 8 | * That is, implementations can hold state, but must take care of its visibility across threads. 9 | */ 10 | public interface BackOff { 11 | /** 12 | * @param cause exception causing the retry attempt before which the delay occurs 13 | * @return non-negative number 14 | */ 15 | long getInMillis(Throwable cause); 16 | 17 | BackOff ZERO = ignored -> 0; 18 | } 19 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/retry/CustomBackOff.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.retry; 2 | 3 | import static io.smallrye.faulttolerance.core.util.Preconditions.checkNotNull; 4 | 5 | import java.util.function.ToLongFunction; 6 | 7 | public class CustomBackOff implements BackOff { 8 | private final ToLongFunction strategy; 9 | 10 | public CustomBackOff(ToLongFunction strategy) { 11 | this.strategy = checkNotNull(strategy, "Custom backoff strategy must be set"); 12 | } 13 | 14 | @Override 15 | public long getInMillis(Throwable cause) { 16 | return strategy.applyAsLong(cause); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/retry/FixedJitter.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.retry; 2 | 3 | import static io.smallrye.faulttolerance.core.util.Preconditions.check; 4 | 5 | /** 6 | * Always returns the same {@code value}. 7 | */ 8 | public class FixedJitter implements Jitter { 9 | private final long value; 10 | 11 | public FixedJitter(long value) { 12 | this.value = check(value, value >= 0, "Fixed jitter must be >= 0"); 13 | } 14 | 15 | @Override 16 | public long generate() { 17 | return value; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/retry/Jitter.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.retry; 2 | 3 | /** 4 | * Implementations must be thread-safe. 5 | */ 6 | public interface Jitter { 7 | long generate(); 8 | 9 | Jitter ZERO = new FixedJitter(0); 10 | } 11 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/retry/RetryLogger.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.retry; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | 5 | import org.jboss.logging.BasicLogger; 6 | import org.jboss.logging.Logger; 7 | import org.jboss.logging.annotations.MessageLogger; 8 | 9 | @MessageLogger(projectCode = "SRFTL", length = 5) 10 | interface RetryLogger extends BasicLogger { 11 | RetryLogger LOG = Logger.getMessageLogger(MethodHandles.lookup(), RetryLogger.class, 12 | RetryLogger.class.getPackage().getName()); 13 | } 14 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/retry/SyncDelay.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.retry; 2 | 3 | import java.util.function.Supplier; 4 | 5 | /** 6 | * Performs a delay synchronously. That is, blocks the calling thread for the duration of the delay. 7 | */ 8 | public interface SyncDelay { 9 | void sleep(Throwable cause) throws InterruptedException; 10 | 11 | Supplier NONE = () -> cause -> { 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/retry/ThreadSleepDelay.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.retry; 2 | 3 | import static io.smallrye.faulttolerance.core.util.Preconditions.checkNotNull; 4 | 5 | /** 6 | * Sync delay based on {@code Thread.sleep}. 7 | */ 8 | public class ThreadSleepDelay implements SyncDelay { 9 | private final BackOff backOff; 10 | 11 | public ThreadSleepDelay(BackOff backOff) { 12 | this.backOff = checkNotNull(backOff, "Back-off must be set"); 13 | } 14 | 15 | @Override 16 | public void sleep(Throwable cause) throws InterruptedException { 17 | long delay = backOff.getInMillis(cause); 18 | if (delay > 0) { 19 | Thread.sleep(delay); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/stopwatch/RunningStopwatch.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.stopwatch; 2 | 3 | public interface RunningStopwatch { 4 | /** 5 | * Returns the number of milliseconds that elapsed since {@link Stopwatch#start()}. 6 | */ 7 | long elapsedTimeInMillis(); 8 | } 9 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/stopwatch/Stopwatch.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.stopwatch; 2 | 3 | public interface Stopwatch { 4 | RunningStopwatch start(); 5 | } 6 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/stopwatch/SystemStopwatch.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.stopwatch; 2 | 3 | public class SystemStopwatch implements Stopwatch { 4 | public static final SystemStopwatch INSTANCE = new SystemStopwatch(); 5 | 6 | private SystemStopwatch() { 7 | // avoid instantiation 8 | } 9 | 10 | @Override 11 | public RunningStopwatch start() { 12 | long start = System.nanoTime(); 13 | 14 | return () -> { 15 | long now = System.nanoTime(); 16 | return (now - start) / 1_000_000; 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/timeout/FutureTimeoutNotification.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.timeout; 2 | 3 | import org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException; 4 | 5 | @FunctionalInterface 6 | interface FutureTimeoutNotification { 7 | void accept(TimeoutException timeoutException); 8 | } 9 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/timeout/TimeoutEvents.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.timeout; 2 | 3 | import io.smallrye.faulttolerance.core.FaultToleranceEvent; 4 | 5 | public class TimeoutEvents { 6 | public enum Started implements FaultToleranceEvent { 7 | INSTANCE 8 | } 9 | 10 | public enum Finished implements FaultToleranceEvent { 11 | NORMALLY(false), 12 | TIMED_OUT(true), 13 | ; 14 | 15 | public final boolean timedOut; 16 | 17 | Finished(boolean timedOut) { 18 | this.timedOut = timedOut; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/timer/TimerTask.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.timer; 2 | 3 | /** 4 | * Result of scheduling a task on a {@link Timer}. Allows observing whether the task 5 | * {@linkplain #isDone() is done} and {@linkplain #cancel() cancelling} the task. 6 | */ 7 | public interface TimerTask { 8 | /** 9 | * Returns whether this task is done. A task is done if it has already finished or was successfully cancelled. 10 | * 11 | * @return whether this task is done 12 | */ 13 | boolean isDone(); 14 | 15 | /** 16 | * Requests cancellation of this task. Task cannot be cancelled when it's already running. 17 | * 18 | * @return whether the task was successfully cancelled 19 | */ 20 | boolean cancel(); 21 | } 22 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/util/ExceptionDecision.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.util; 2 | 3 | public interface ExceptionDecision { 4 | boolean isConsideredExpected(Throwable e); 5 | 6 | ExceptionDecision ALWAYS_EXPECTED = ignored -> true; 7 | ExceptionDecision ALWAYS_FAILURE = ignored -> false; 8 | 9 | ExceptionDecision IGNORE = ignored -> { 10 | throw new UnsupportedOperationException(); 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/util/PredicateBasedExceptionDecision.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.util; 2 | 3 | import static io.smallrye.faulttolerance.core.util.Preconditions.checkNotNull; 4 | 5 | import java.util.function.Predicate; 6 | 7 | public class PredicateBasedExceptionDecision implements ExceptionDecision { 8 | private final Predicate isExpected; 9 | 10 | public PredicateBasedExceptionDecision(Predicate isExpected) { 11 | this.isExpected = checkNotNull(isExpected, "Exception predicate must be set"); 12 | } 13 | 14 | @Override 15 | public boolean isConsideredExpected(Throwable e) { 16 | return isExpected.test(e); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/util/PredicateBasedResultDecision.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.util; 2 | 3 | import static io.smallrye.faulttolerance.core.util.Preconditions.checkNotNull; 4 | 5 | import java.util.function.Predicate; 6 | 7 | public class PredicateBasedResultDecision implements ResultDecision { 8 | private final Predicate isExpected; 9 | 10 | public PredicateBasedResultDecision(Predicate isExpected) { 11 | this.isExpected = checkNotNull(isExpected, "Result predicate must be set"); 12 | } 13 | 14 | @Override 15 | public boolean isConsideredExpected(Object obj) { 16 | return isExpected.test(obj); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/util/Primitives.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.util; 2 | 3 | public class Primitives { 4 | private Primitives() { 5 | // avoid instantiation 6 | } 7 | 8 | public static long clamp(long value, long min, long max) { 9 | return Math.min(Math.max(value, min), max); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/util/ResultDecision.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.util; 2 | 3 | public interface ResultDecision { 4 | boolean isConsideredExpected(Object obj); 5 | 6 | ResultDecision ALWAYS_EXPECTED = ignored -> true; 7 | ResultDecision ALWAYS_FAILURE = ignored -> false; 8 | } 9 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/util/RunnableWrapper.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.util; 2 | 3 | import java.util.ServiceLoader; 4 | 5 | /** 6 | * Used by {@link io.smallrye.faulttolerance.core.timer.Timer Timer} 7 | * and {@link io.smallrye.faulttolerance.core.event.loop.EventLoop EventLoop}. 8 | */ 9 | public interface RunnableWrapper { 10 | Runnable wrap(Runnable runnable); 11 | 12 | RunnableWrapper INSTANCE = Loader.load(); 13 | 14 | // --- 15 | 16 | class Loader { 17 | private static RunnableWrapper load() { 18 | for (RunnableWrapper found : ServiceLoader.load(RunnableWrapper.class)) { 19 | return found; 20 | } 21 | return runnable -> runnable; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /implementation/core/src/main/java/io/smallrye/faulttolerance/core/util/SneakyThrow.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.util; 2 | 3 | public class SneakyThrow { 4 | private SneakyThrow() { 5 | } 6 | 7 | /** 8 | * This method can and should be used as part of a {@code throw} statement, 9 | * such as: {@code throw sneakyThrow(exception);}. It is guaranteed to never return normally, 10 | * and this style of usage makes sure that the Java compiler is aware of that. 11 | */ 12 | @SuppressWarnings("unchecked") 13 | public static RuntimeException sneakyThrow(Throwable e) throws E { 14 | throw (E) e; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /implementation/core/src/main/resources/META-INF/services/io.smallrye.faulttolerance.core.invocation.AsyncSupport: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.core.invocation.CompletionStageSupport -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/FaultToleranceContextUtil.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core; 2 | 3 | import java.util.concurrent.Callable; 4 | 5 | public class FaultToleranceContextUtil { 6 | public static FaultToleranceContext sync(Callable callable) { 7 | return new FaultToleranceContext<>(() -> Future.from(callable), false); 8 | } 9 | 10 | public static FaultToleranceContext async(Callable callable) { 11 | return new FaultToleranceContext<>(() -> Future.from(callable), true); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/circuit/breaker/BitsetRollingWindowTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.circuit.breaker; 2 | 3 | public class BitsetRollingWindowTest extends AbstractRollingWindowTest { 4 | @Override 5 | protected RollingWindow createRollingWindow(int size, int failureThreshold) { 6 | return new BitsetRollingWindow(size, failureThreshold); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/circuit/breaker/DefaultRollingWindowTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.circuit.breaker; 2 | 3 | public class DefaultRollingWindowTest extends AbstractRollingWindowTest { 4 | @Override 5 | protected RollingWindow createRollingWindow(int size, int failureThreshold) { 6 | return RollingWindow.create(size, failureThreshold); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/circuit/breaker/NaiveRollingWindowTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.circuit.breaker; 2 | 3 | public class NaiveRollingWindowTest extends AbstractRollingWindowTest { 4 | @Override 5 | protected RollingWindow createRollingWindow(int size, int failureThreshold) { 6 | return new NaiveRollingWindow(size, failureThreshold); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/composition/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Test that the FT strategies can be combined in the way required by MicroProfile Fault Tolerance. 3 | */ 4 | package io.smallrye.faulttolerance.core.composition; 5 | -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/rate/limit/NaiveRollingWindowTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.rate.limit; 2 | 3 | import io.smallrye.faulttolerance.core.stopwatch.Stopwatch; 4 | 5 | public class NaiveRollingWindowTest extends AbstractRollingWindowTest { 6 | @Override 7 | protected TimeWindow createRollingWindow(Stopwatch stopwatch, int maxInvocations, long timeWindowInMillis, 8 | long minSpacingInMillis) { 9 | return new NaiveRollingWindow(stopwatch, maxInvocations, timeWindowInMillis, minSpacingInMillis); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/rate/limit/RingBufferRollingWindowTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.rate.limit; 2 | 3 | import io.smallrye.faulttolerance.core.stopwatch.Stopwatch; 4 | 5 | public class RingBufferRollingWindowTest extends AbstractRollingWindowTest { 6 | @Override 7 | protected TimeWindow createRollingWindow(Stopwatch stopwatch, int maxInvocations, long timeWindowInMillis, 8 | long minSpacingInMillis) { 9 | return new RingBufferRollingWindow(stopwatch, maxInvocations, timeWindowInMillis, minSpacingInMillis); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/stopwatch/TestStopwatch.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.stopwatch; 2 | 3 | public class TestStopwatch implements Stopwatch { 4 | private volatile long currentValue; 5 | 6 | public void setCurrentValue(long currentValue) { 7 | this.currentValue = currentValue; 8 | } 9 | 10 | @Override 11 | public RunningStopwatch start() { 12 | return new RunningStopwatch() { 13 | @Override 14 | public long elapsedTimeInMillis() { 15 | return currentValue; 16 | } 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/util/Action.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.util; 2 | 3 | import static io.smallrye.faulttolerance.core.util.SneakyThrow.sneakyThrow; 4 | 5 | public interface Action { 6 | void run() throws Exception; 7 | 8 | static void startThread(Action action) { 9 | new Thread(() -> { 10 | try { 11 | action.run(); 12 | } catch (Exception e) { 13 | sneakyThrow(e); 14 | } 15 | }).start(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/util/PrimitivesTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.util; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | public class PrimitivesTest { 8 | @Test 9 | public void clamp() { 10 | assertThat(Primitives.clamp(1, 2, 3)).isEqualTo(2); 11 | assertThat(Primitives.clamp(2, 1, 3)).isEqualTo(2); 12 | assertThat(Primitives.clamp(3, 1, 2)).isEqualTo(2); 13 | 14 | assertThat(Primitives.clamp(1, 1, 3)).isEqualTo(1); 15 | assertThat(Primitives.clamp(3, 1, 3)).isEqualTo(3); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/util/TestException.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.util; 2 | 3 | import static io.smallrye.faulttolerance.core.util.SneakyThrow.sneakyThrow; 4 | 5 | public class TestException extends Exception { 6 | public TestException() { 7 | } 8 | 9 | // generic return type so that reference to this method can be used as `j.u.f.Supplier` 10 | public static V doThrow() { 11 | throw sneakyThrow(new TestException()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/util/Timing.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.util; 2 | 3 | public class Timing { 4 | public static long timed(Action action) throws Exception { 5 | long start = System.nanoTime(); 6 | action.run(); 7 | long end = System.nanoTime(); 8 | return (end - start) / 1_000_000; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/util/barrier/Barrier.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.util.barrier; 2 | 3 | public interface Barrier { 4 | void await() throws InterruptedException; 5 | 6 | void open(); 7 | 8 | static Barrier interruptible() { 9 | return new BarrierImpl(true); 10 | } 11 | 12 | static Barrier noninterruptible() { 13 | return new BarrierImpl(false); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /implementation/core/src/test/java/io/smallrye/faulttolerance/core/util/party/Party.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.core.util.party; 2 | 3 | public interface Party { 4 | Participant participant(); 5 | 6 | Organizer organizer(); 7 | 8 | static Party create(int participants) { 9 | return new PartyImpl(participants); 10 | } 11 | 12 | interface Participant { 13 | void attend() throws InterruptedException; 14 | } 15 | 16 | interface Organizer { 17 | void waitForAll() throws InterruptedException; 18 | 19 | void disband(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/AsyncExecutorProvider.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance; 2 | 3 | import java.util.concurrent.ExecutorService; 4 | 5 | /** 6 | * Integrators should provide a CDI bean which implements {@link AsyncExecutorProvider}. The bean should be 7 | * {@code @Singleton}, must be marked as alternative and selected globally for the application. 8 | */ 9 | public interface AsyncExecutorProvider { 10 | /** 11 | * Provides the thread pool for executing {@code @Asynchronous} methods and other asynchronous tasks. 12 | * Integrator is responsible for the thread pool's lifecycle. 13 | */ 14 | ExecutorService get(); 15 | } 16 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/BeforeRetryHandlerProvider.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import io.smallrye.faulttolerance.api.BeforeRetryHandler; 6 | import io.smallrye.faulttolerance.config.FaultToleranceOperation; 7 | 8 | /** 9 | * An integrator is allowed to provide a custom implementation of {@link BeforeRetryHandlerProvider}. The bean should be 10 | * {@link Dependent}, must be marked as alternative and selected globally for an application. 11 | */ 12 | public interface BeforeRetryHandlerProvider { 13 | BeforeRetryHandler get(FaultToleranceOperation operation); 14 | } 15 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/CircuitBreakerMaintenanceImpl.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance; 2 | 3 | import jakarta.inject.Inject; 4 | import jakarta.inject.Singleton; 5 | 6 | import io.smallrye.faulttolerance.apiimpl.BasicCircuitBreakerMaintenanceImpl; 7 | 8 | @Singleton 9 | public class CircuitBreakerMaintenanceImpl extends BasicCircuitBreakerMaintenanceImpl { 10 | @Inject 11 | public CircuitBreakerMaintenanceImpl(ExistingCircuitBreakerNames existingCircuitBreakerNames) { 12 | super(existingCircuitBreakerNames::contains); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/ExistingCircuitBreakerNames.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance; 2 | 3 | import jakarta.inject.Singleton; 4 | 5 | /** 6 | * An integrator is allowed to provide a custom implementation of {@link ExistingCircuitBreakerNames}. The bean 7 | * should be {@link Singleton}, must be marked as alternative and selected globally for an application. 8 | */ 9 | public interface ExistingCircuitBreakerNames { 10 | boolean contains(String name); 11 | } 12 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/RequestContextIntegration.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance; 2 | 3 | import jakarta.enterprise.context.control.RequestContextController; 4 | import jakarta.inject.Singleton; 5 | 6 | import io.smallrye.faulttolerance.internal.RequestContextControllerProvider; 7 | 8 | @Singleton 9 | public class RequestContextIntegration { 10 | private final RequestContextControllerProvider provider = RequestContextControllerProvider.load(); 11 | 12 | public RequestContextController get() { 13 | return provider.get(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/config/ApplyFaultToleranceConfig.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config; 2 | 3 | import io.smallrye.faulttolerance.api.ApplyFaultTolerance; 4 | import io.smallrye.faulttolerance.autoconfig.AutoConfig; 5 | import io.smallrye.faulttolerance.autoconfig.ConfigDeclarativeOnly; 6 | 7 | @AutoConfig(newConfigAllowed = false) 8 | public interface ApplyFaultToleranceConfig extends ApplyFaultTolerance, ConfigDeclarativeOnly { 9 | @Override 10 | default void validate() { 11 | if (value().isEmpty()) { 12 | throw fail("value", "shouldn't be empty"); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/config/ApplyGuardConfig.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config; 2 | 3 | import io.smallrye.faulttolerance.api.ApplyGuard; 4 | import io.smallrye.faulttolerance.autoconfig.AutoConfig; 5 | import io.smallrye.faulttolerance.autoconfig.ConfigDeclarativeOnly; 6 | 7 | @AutoConfig 8 | public interface ApplyGuardConfig extends ApplyGuard, ConfigDeclarativeOnly { 9 | @Override 10 | default void validate() { 11 | if (value().isEmpty()) { 12 | throw fail("value", "shouldn't be empty"); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/config/BeforeRetryConfig.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config; 2 | 3 | import io.smallrye.faulttolerance.api.BeforeRetry; 4 | import io.smallrye.faulttolerance.autoconfig.AutoConfig; 5 | import io.smallrye.faulttolerance.autoconfig.ConfigDeclarativeOnly; 6 | 7 | @AutoConfig 8 | public interface BeforeRetryConfig extends BeforeRetry, ConfigDeclarativeOnly { 9 | default void validate() { 10 | if (!"".equals(methodName()) && !DEFAULT.class.equals(value())) { 11 | throw fail("before retry handler class and before retry method can't be specified both at the same time"); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/config/BlockingConfig.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config; 2 | 3 | import io.smallrye.common.annotation.Blocking; 4 | import io.smallrye.faulttolerance.autoconfig.AutoConfig; 5 | import io.smallrye.faulttolerance.autoconfig.ConfigDeclarativeOnly; 6 | 7 | @AutoConfig(newConfigAllowed = false) 8 | public interface BlockingConfig extends Blocking, ConfigDeclarativeOnly { 9 | @Override 10 | default void validate() { 11 | // we don't validate the method return type, because the @Blocking annotation 12 | // may be present for another framework and we're supposed to ignore it 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/config/CircuitBreakerNameConfig.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config; 2 | 3 | import io.smallrye.faulttolerance.api.CircuitBreakerName; 4 | import io.smallrye.faulttolerance.autoconfig.AutoConfig; 5 | import io.smallrye.faulttolerance.autoconfig.ConfigDeclarativeOnly; 6 | 7 | @AutoConfig(configurable = false) 8 | public interface CircuitBreakerNameConfig extends CircuitBreakerName, ConfigDeclarativeOnly { 9 | @Override 10 | default void validate() { 11 | if (value().isEmpty()) { 12 | throw fail("value", "must not be empty"); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/config/CustomBackoffConfig.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config; 2 | 3 | import io.smallrye.faulttolerance.api.CustomBackoff; 4 | import io.smallrye.faulttolerance.autoconfig.AutoConfig; 5 | import io.smallrye.faulttolerance.autoconfig.ConfigDeclarativeOnly; 6 | 7 | @AutoConfig 8 | public interface CustomBackoffConfig extends CustomBackoff, ConfigDeclarativeOnly { 9 | @Override 10 | default void validate() { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/config/NonBlockingConfig.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config; 2 | 3 | import io.smallrye.common.annotation.NonBlocking; 4 | import io.smallrye.faulttolerance.autoconfig.AutoConfig; 5 | import io.smallrye.faulttolerance.autoconfig.ConfigDeclarativeOnly; 6 | 7 | @AutoConfig(newConfigAllowed = false) 8 | public interface NonBlockingConfig extends NonBlocking, ConfigDeclarativeOnly { 9 | @Override 10 | default void validate() { 11 | // we don't validate the method return type, because the @NonBlocking annotation 12 | // may be present for another framework and we're supposed to ignore it 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/config/RetryWhenConfig.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config; 2 | 3 | import io.smallrye.faulttolerance.api.RetryWhen; 4 | import io.smallrye.faulttolerance.autoconfig.AutoConfig; 5 | import io.smallrye.faulttolerance.autoconfig.ConfigDeclarativeOnly; 6 | 7 | @AutoConfig 8 | public interface RetryWhenConfig extends RetryWhen, ConfigDeclarativeOnly { 9 | @Override 10 | default void validate() { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/DefaultRequestContextControllerProvider.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.internal; 2 | 3 | import jakarta.enterprise.context.control.RequestContextController; 4 | import jakarta.enterprise.inject.spi.CDI; 5 | 6 | public class DefaultRequestContextControllerProvider implements RequestContextControllerProvider { 7 | @Override 8 | public RequestContextController get() { 9 | return CDI.current().select(RequestContextController.class).get(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/InternalLogger.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.internal; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | 5 | import org.jboss.logging.BasicLogger; 6 | import org.jboss.logging.Logger; 7 | import org.jboss.logging.annotations.MessageLogger; 8 | 9 | @MessageLogger(projectCode = "SRFTL", length = 5) 10 | interface InternalLogger extends BasicLogger { 11 | InternalLogger LOG = Logger.getMessageLogger(MethodHandles.lookup(), InternalLogger.class, 12 | InternalLogger.class.getPackage().getName()); 13 | } 14 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/KotlinSupport.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.internal; 2 | 3 | import java.lang.reflect.Method; 4 | 5 | // TODO this would ideally live in the `kotlin` module 6 | final class KotlinSupport { 7 | private static final String KOTLIN_CONTINUATION = "kotlin.coroutines.Continuation"; 8 | 9 | static boolean isSuspendingFunction(Method method) { 10 | int params = method.getParameterCount(); 11 | return params > 0 && method.getParameterTypes()[params - 1].getName().equals(KOTLIN_CONTINUATION); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/RequestContextControllerProvider.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.internal; 2 | 3 | import java.util.ServiceLoader; 4 | 5 | import jakarta.enterprise.context.control.RequestContextController; 6 | 7 | /** 8 | * This is not a public SPI, it's only meant to be used internally. 9 | */ 10 | public interface RequestContextControllerProvider { 11 | RequestContextController get(); 12 | 13 | static RequestContextControllerProvider load() { 14 | for (RequestContextControllerProvider found : ServiceLoader.load(RequestContextControllerProvider.class)) { 15 | return found; 16 | } 17 | return new DefaultRequestContextControllerProvider(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/metrics/MetricsIntegration.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.metrics; 2 | 3 | public enum MetricsIntegration { 4 | /** 5 | * Metrics integration using {@link MicroProfileMetricsProvider}. 6 | */ 7 | MICROPROFILE_METRICS, 8 | /** 9 | * Metrics integration using {@link OpenTelemetryProvider}. 10 | */ 11 | OPENTELEMETRY, 12 | /** 13 | * Metrics integration using {@link MicrometerProvider}. 14 | */ 15 | MICROMETER, 16 | /** 17 | * Metrics will be disabled using {@link NoopProvider}. 18 | */ 19 | NOOP, 20 | } 21 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/metrics/NoopProvider.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.metrics; 2 | 3 | import jakarta.inject.Singleton; 4 | 5 | import io.smallrye.faulttolerance.core.metrics.MeteredOperation; 6 | import io.smallrye.faulttolerance.core.metrics.MetricsProvider; 7 | import io.smallrye.faulttolerance.core.metrics.MetricsRecorder; 8 | 9 | @Singleton 10 | public class NoopProvider implements MetricsProvider { 11 | @Override 12 | public boolean isEnabled() { 13 | return false; 14 | } 15 | 16 | @Override 17 | public MetricsRecorder create(MeteredOperation operation) { 18 | return MetricsRecorder.NOOP; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/resources/META-INF/services/io.smallrye.faulttolerance.api.Spi: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.CdiSpi 2 | -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.FaultToleranceExtension -------------------------------------------------------------------------------- /implementation/fault-tolerance/src/main/resources/smallrye-fault-tolerance.properties: -------------------------------------------------------------------------------- 1 | version=${project.version} 2 | -------------------------------------------------------------------------------- /implementation/kotlin/src/main/resources/META-INF/services/io.smallrye.faulttolerance.core.invocation.AsyncSupport: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.kotlin.impl.CoroutineSupport -------------------------------------------------------------------------------- /implementation/mutiny/src/main/resources/META-INF/services/io.smallrye.faulttolerance.core.invocation.AsyncSupport: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.mutiny.impl.UniSupport -------------------------------------------------------------------------------- /implementation/mutiny/src/test/java/io/smallrye/faulttolerance/mutiny/test/Types.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.mutiny.test; 2 | 3 | import jakarta.enterprise.util.TypeLiteral; 4 | 5 | import io.smallrye.mutiny.Uni; 6 | 7 | class Types { 8 | static final TypeLiteral> UNI_STRING = new TypeLiteral<>() { 9 | }; 10 | 11 | static final TypeLiteral> UNI_INTEGER = new TypeLiteral<>() { 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /implementation/rxjava3/src/main/resources/META-INF/services/io.smallrye.faulttolerance.core.invocation.AsyncSupport: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.rxjava3.impl.CompletableSupport 2 | io.smallrye.faulttolerance.rxjava3.impl.MaybeSupport 3 | io.smallrye.faulttolerance.rxjava3.impl.SingleSupport -------------------------------------------------------------------------------- /implementation/standalone/src/main/java/io/smallrye/faulttolerance/standalone/EagerDependencies.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.standalone; 2 | 3 | import io.smallrye.faulttolerance.apiimpl.BasicCircuitBreakerMaintenanceImpl; 4 | import io.smallrye.faulttolerance.apiimpl.BuilderEagerDependencies; 5 | 6 | final class EagerDependencies implements BuilderEagerDependencies { 7 | final BasicCircuitBreakerMaintenanceImpl cbMaintenance = new BasicCircuitBreakerMaintenanceImpl(); 8 | 9 | @Override 10 | public BasicCircuitBreakerMaintenanceImpl cbMaintenance() { 11 | return cbMaintenance; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /implementation/standalone/src/main/java/io/smallrye/faulttolerance/standalone/MetricsAdapter.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.standalone; 2 | 3 | public interface MetricsAdapter { 4 | } 5 | -------------------------------------------------------------------------------- /implementation/standalone/src/main/java/io/smallrye/faulttolerance/standalone/TimerAccess.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.standalone; 2 | 3 | /** 4 | * Provides read-only view into the SmallRye Fault Tolerance timer. 5 | *

6 | * Implementations must be thread-safe. 7 | */ 8 | @Deprecated(forRemoval = true) 9 | public interface TimerAccess { 10 | /** 11 | * Returns the number of tasks that are currently scheduled for execution by the timer. 12 | * Finished tasks and tasks that are already running are not included. 13 | * 14 | * @return the number of currently scheduled tasks 15 | */ 16 | @Deprecated(forRemoval = true) 17 | int countScheduledTasks(); 18 | } 19 | -------------------------------------------------------------------------------- /implementation/standalone/src/main/java/io/smallrye/faulttolerance/standalone/TimerAccessImpl.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.standalone; 2 | 3 | import io.smallrye.faulttolerance.core.timer.Timer; 4 | 5 | final class TimerAccessImpl implements TimerAccess { 6 | private final Timer timer; 7 | 8 | TimerAccessImpl(Timer timer) { 9 | this.timer = timer; 10 | } 11 | 12 | @Override 13 | public int countScheduledTasks() { 14 | return timer.countScheduledTasks(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /implementation/standalone/src/main/resources/META-INF/services/io.smallrye.faulttolerance.api.Spi: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.standalone.StandaloneSpi 2 | -------------------------------------------------------------------------------- /implementation/standalone/src/test/java/io/smallrye/faulttolerance/standalone/test/Types.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.standalone.test; 2 | 3 | import java.util.concurrent.CompletionStage; 4 | 5 | import jakarta.enterprise.util.TypeLiteral; 6 | 7 | class Types { 8 | static final TypeLiteral> CS_STRING = new TypeLiteral<>() { 9 | }; 10 | 11 | static final TypeLiteral> CS_INTEGER = new TypeLiteral<>() { 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /implementation/standalone/src/test/resources/logging.properties: -------------------------------------------------------------------------------- 1 | handlers = java.util.logging.ConsoleHandler 2 | java.util.logging.ConsoleHandler.level = FINEST 3 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter 4 | java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL %4$-5s [%3$s] %5$s%6$s%n 5 | io.smallrye.faulttolerance.level = INFO 6 | -------------------------------------------------------------------------------- /implementation/tracing-propagation/src/main/resources/META-INF/services/org.eclipse.microprofile.context.spi.ThreadContextProvider: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.tracing.TracingContextProvider 2 | -------------------------------------------------------------------------------- /implementation/vertx/src/main/java/io/smallrye/faulttolerance/vertx/VertxLogger.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.vertx; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | 5 | import org.jboss.logging.BasicLogger; 6 | import org.jboss.logging.Logger; 7 | import org.jboss.logging.annotations.MessageLogger; 8 | 9 | @MessageLogger(projectCode = "SRFTL", length = 5) 10 | interface VertxLogger extends BasicLogger { 11 | VertxLogger LOG = Logger.getMessageLogger(MethodHandles.lookup(), VertxLogger.class, 12 | VertxLogger.class.getPackage().getName()); 13 | } 14 | -------------------------------------------------------------------------------- /implementation/vertx/src/main/resources/META-INF/services/io.smallrye.faulttolerance.core.event.loop.EventLoop: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.vertx.VertxEventLoop -------------------------------------------------------------------------------- /release/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | io.smallrye 7 | smallrye-fault-tolerance-parent 8 | 6.9.2-SNAPSHOT 9 | 10 | 11 | smallrye-fault-tolerance-release 12 | pom 13 | 14 | Empty Release Project to Avoid Maven Bug 15 | Empty Release Project to Avoid Maven Bug 16 | 17 | 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/Types.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance; 2 | 3 | import java.util.concurrent.CompletionStage; 4 | 5 | import jakarta.enterprise.util.TypeLiteral; 6 | 7 | import io.smallrye.mutiny.Uni; 8 | 9 | public class Types { 10 | public static final TypeLiteral> CS_STRING = new TypeLiteral<>() { 11 | }; 12 | 13 | public static final TypeLiteral> UNI_STRING = new TypeLiteral<>() { 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/async/additional/error/clazz/BlockingNonBlockingOnClassService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.async.additional.error.clazz; 2 | 3 | import java.util.concurrent.CompletionStage; 4 | 5 | import jakarta.enterprise.context.Dependent; 6 | 7 | import org.eclipse.microprofile.faulttolerance.Retry; 8 | 9 | import io.smallrye.common.annotation.Blocking; 10 | import io.smallrye.common.annotation.NonBlocking; 11 | 12 | @Dependent 13 | @Blocking 14 | @NonBlocking 15 | public class BlockingNonBlockingOnClassService { 16 | @Retry 17 | public CompletionStage hello() { 18 | throw new IllegalArgumentException(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/async/additional/error/clazz/BlockingNonBlockingOnClassTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.async.additional.error.clazz; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class BlockingNonBlockingOnClassTest { 13 | @Test 14 | public void test(BlockingNonBlockingOnClassService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/async/additional/error/clazz/BothAsyncOnClassService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.async.additional.error.clazz; 2 | 3 | import java.util.concurrent.CompletionStage; 4 | 5 | import jakarta.enterprise.context.Dependent; 6 | 7 | import org.eclipse.microprofile.faulttolerance.Asynchronous; 8 | import org.eclipse.microprofile.faulttolerance.Retry; 9 | 10 | import io.smallrye.faulttolerance.api.AsynchronousNonBlocking; 11 | 12 | @Dependent 13 | @Asynchronous 14 | @AsynchronousNonBlocking 15 | public class BothAsyncOnClassService { 16 | @Retry 17 | public CompletionStage hello() { 18 | throw new IllegalArgumentException(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/async/additional/error/clazz/BothAsyncOnClassTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.async.additional.error.clazz; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class BothAsyncOnClassTest { 13 | @Test 14 | public void test(BothAsyncOnClassService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/async/additional/error/method/BlockingNonBlockingOnMethodService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.async.additional.error.method; 2 | 3 | import java.util.concurrent.CompletionStage; 4 | 5 | import jakarta.enterprise.context.Dependent; 6 | 7 | import org.eclipse.microprofile.faulttolerance.Retry; 8 | 9 | import io.smallrye.common.annotation.Blocking; 10 | import io.smallrye.common.annotation.NonBlocking; 11 | 12 | @Dependent 13 | public class BlockingNonBlockingOnMethodService { 14 | @Retry 15 | @Blocking 16 | @NonBlocking 17 | public CompletionStage hello() { 18 | throw new IllegalArgumentException(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/async/additional/error/method/BlockingNonBlockingOnMethodTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.async.additional.error.method; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class BlockingNonBlockingOnMethodTest { 13 | @Test 14 | public void test(BlockingNonBlockingOnMethodService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/async/additional/error/method/BothAsyncOnMethodService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.async.additional.error.method; 2 | 3 | import java.util.concurrent.CompletionStage; 4 | 5 | import jakarta.enterprise.context.Dependent; 6 | 7 | import org.eclipse.microprofile.faulttolerance.Asynchronous; 8 | import org.eclipse.microprofile.faulttolerance.Retry; 9 | 10 | import io.smallrye.faulttolerance.api.AsynchronousNonBlocking; 11 | 12 | @Dependent 13 | public class BothAsyncOnMethodService { 14 | @Retry 15 | @Asynchronous 16 | @AsynchronousNonBlocking 17 | public CompletionStage hello() { 18 | throw new IllegalArgumentException(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/async/additional/error/method/BothAsyncOnMethodTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.async.additional.error.method; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class BothAsyncOnMethodTest { 13 | @Test 14 | public void test(BothAsyncOnMethodService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/async/compstage/exception/HelloException.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.async.compstage.exception; 2 | 3 | public class HelloException extends RuntimeException { 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/async/sizing/AsyncThreadPoolSizingOldConfigTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.async.sizing; 2 | 3 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 4 | import io.smallrye.faulttolerance.util.WithSystemProperty; 5 | 6 | @WithSystemProperty(key = "io.smallrye.faulttolerance.globalThreadPoolSize", value = "10") 7 | @WithSystemProperty(key = "io.smallrye.faulttolerance.mainThreadPoolQueueSize", value = "0") 8 | @FaultToleranceBasicTest 9 | public class AsyncThreadPoolSizingOldConfigTest extends AbstractAsyncThreadPoolSizingTest { 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/async/sizing/AsyncThreadPoolSizingTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.async.sizing; 2 | 3 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 4 | import io.smallrye.faulttolerance.util.WithSystemProperty; 5 | 6 | @WithSystemProperty(key = "io.smallrye.faulttolerance.mainThreadPoolSize", value = "10") 7 | @WithSystemProperty(key = "io.smallrye.faulttolerance.mainThreadPoolQueueSize", value = "0") 8 | @FaultToleranceBasicTest 9 | public class AsyncThreadPoolSizingTest extends AbstractAsyncThreadPoolSizingTest { 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/async/sizing/HelloService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.async.sizing; 2 | 3 | import static java.util.concurrent.CompletableFuture.completedFuture; 4 | 5 | import java.util.concurrent.CompletionStage; 6 | 7 | import jakarta.enterprise.context.ApplicationScoped; 8 | 9 | import org.eclipse.microprofile.faulttolerance.Asynchronous; 10 | 11 | import io.smallrye.faulttolerance.core.util.party.Party; 12 | 13 | @ApplicationScoped 14 | public class HelloService { 15 | 16 | @Asynchronous 17 | public CompletionStage hello(Party.Participant participant) throws InterruptedException { 18 | participant.attend(); 19 | return completedFuture("hello"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/async/types/rxjava/resubscription/HelloService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.async.types.rxjava.resubscription; 2 | 3 | import java.util.concurrent.atomic.AtomicInteger; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | 7 | import org.eclipse.microprofile.faulttolerance.Retry; 8 | 9 | import io.reactivex.rxjava3.core.Maybe; 10 | import io.smallrye.faulttolerance.api.AsynchronousNonBlocking; 11 | 12 | @ApplicationScoped 13 | public class HelloService { 14 | static final AtomicInteger COUNTER = new AtomicInteger(0); 15 | 16 | @AsynchronousNonBlocking 17 | @Retry 18 | public Maybe hello() { 19 | COUNTER.incrementAndGet(); 20 | return Maybe.error(IllegalArgumentException::new); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/bulkhead/capacity/overflow/BulkheadCapacityOverflowTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.bulkhead.capacity.overflow; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class BulkheadCapacityOverflowTest { 13 | @Test 14 | public void test(MyService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/bulkhead/capacity/overflow/MyService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.bulkhead.capacity.overflow; 2 | 3 | import static java.util.concurrent.CompletableFuture.completedFuture; 4 | 5 | import java.util.concurrent.CompletionStage; 6 | 7 | import jakarta.enterprise.context.ApplicationScoped; 8 | 9 | import org.eclipse.microprofile.faulttolerance.Asynchronous; 10 | import org.eclipse.microprofile.faulttolerance.Bulkhead; 11 | 12 | @ApplicationScoped 13 | public class MyService { 14 | @Asynchronous 15 | @Bulkhead(value = 1, waitingTaskQueue = Integer.MAX_VALUE) 16 | public CompletionStage hello() { 17 | return completedFuture("hello"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/circuitbreaker/maintenance/duplicate/CircuitBreakerService1.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.circuitbreaker.maintenance.duplicate; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | 5 | import org.eclipse.microprofile.faulttolerance.CircuitBreaker; 6 | 7 | import io.smallrye.faulttolerance.api.CircuitBreakerName; 8 | 9 | @ApplicationScoped 10 | public class CircuitBreakerService1 { 11 | @CircuitBreaker 12 | @CircuitBreakerName("hello") 13 | public String hello() { 14 | return "1"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/circuitbreaker/maintenance/duplicate/CircuitBreakerService2.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.circuitbreaker.maintenance.duplicate; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | 5 | import org.eclipse.microprofile.faulttolerance.CircuitBreaker; 6 | 7 | import io.smallrye.faulttolerance.api.CircuitBreakerName; 8 | 9 | @ApplicationScoped 10 | public class CircuitBreakerService2 { 11 | @CircuitBreaker 12 | @CircuitBreakerName("hello") 13 | public String hello() { 14 | return "2"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/circuitbreaker/maintenance/duplicate/DuplicateCircuitBreakerNameTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.circuitbreaker.maintenance.duplicate; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class DuplicateCircuitBreakerNameTest { 13 | @Test 14 | public void test(CircuitBreakerService1 ignored1, CircuitBreakerService2 ignored2) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/circuitbreaker/maintenance/inheritance/SubCircuitBreakerService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.circuitbreaker.maintenance.inheritance; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Typed; 5 | 6 | import org.eclipse.microprofile.faulttolerance.CircuitBreaker; 7 | 8 | @ApplicationScoped 9 | @CircuitBreaker 10 | @Typed(SubCircuitBreakerService.class) 11 | public class SubCircuitBreakerService extends SuperCircuitBreakerService { 12 | @Override 13 | public String hello() { 14 | return "sub"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/circuitbreaker/maintenance/inheritance/SuperCircuitBreakerService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.circuitbreaker.maintenance.inheritance; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Typed; 5 | 6 | import org.eclipse.microprofile.faulttolerance.CircuitBreaker; 7 | 8 | import io.smallrye.faulttolerance.api.CircuitBreakerName; 9 | 10 | @ApplicationScoped 11 | @Typed(SuperCircuitBreakerService.class) 12 | public class SuperCircuitBreakerService { 13 | @CircuitBreaker 14 | @CircuitBreakerName("hello") 15 | public String hello() { 16 | return "super"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/config/better/ConfigPropertyBean.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config.better; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | @Dependent 8 | @Retry 9 | public class ConfigPropertyBean { 10 | private int retry = 0; 11 | 12 | @Retry 13 | public void triggerException() { 14 | retry++; 15 | throw new IllegalStateException("Exception"); 16 | } 17 | 18 | public int getRetry() { 19 | return retry; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/config/better/FallbackHandlerA.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config.better; 2 | 3 | import org.eclipse.microprofile.faulttolerance.ExecutionContext; 4 | import org.eclipse.microprofile.faulttolerance.FallbackHandler; 5 | 6 | public class FallbackHandlerA implements FallbackHandler { 7 | @Override 8 | public String handle(ExecutionContext context) { 9 | return "FallbackHandlerA"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/config/better/FallbackHandlerB.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config.better; 2 | 3 | import org.eclipse.microprofile.faulttolerance.ExecutionContext; 4 | import org.eclipse.microprofile.faulttolerance.FallbackHandler; 5 | 6 | public class FallbackHandlerB implements FallbackHandler { 7 | @Override 8 | public String handle(ExecutionContext context) { 9 | return "FallbackHandlerB"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/config/better/RateLimitConfigBean.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config.better; 2 | 3 | import java.time.temporal.ChronoUnit; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | 7 | import io.smallrye.faulttolerance.api.RateLimit; 8 | 9 | @ApplicationScoped 10 | public class RateLimitConfigBean { 11 | @RateLimit(value = 10) 12 | public String value() { 13 | return "value"; 14 | } 15 | 16 | @RateLimit(value = 3, window = 10, windowUnit = ChronoUnit.MINUTES) 17 | public String window() { 18 | return "window"; 19 | } 20 | 21 | @RateLimit(value = 3, minSpacing = 10, minSpacingUnit = ChronoUnit.MINUTES) 22 | public String minSpacing() { 23 | return "minSpacing"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/config/better/TestConfigExceptionA.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config.better; 2 | 3 | public class TestConfigExceptionA extends RuntimeException { 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/config/better/TestConfigExceptionB.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config.better; 2 | 3 | public class TestConfigExceptionB extends RuntimeException { 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/config/better/TestConfigExceptionB1.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config.better; 2 | 3 | public class TestConfigExceptionB1 extends TestConfigExceptionB { 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/config/better/TestException.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.config.better; 2 | 3 | public class TestException extends RuntimeException { 4 | } 5 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/defaultmethod/DefaultMethodTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.defaultmethod; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.jboss.weld.junit5.auto.AddBeanClasses; 6 | import org.jboss.weld.junit5.auto.AddExtensions; 7 | import org.junit.jupiter.api.Test; 8 | 9 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 10 | 11 | @FaultToleranceBasicTest 12 | @AddExtensions(InterfaceBasedExtension.class) 13 | @AddBeanClasses(SimpleService.class) 14 | public class DefaultMethodTest { 15 | @Test 16 | public void test(HelloService service) { 17 | assertThat(service.hello()).isEqualTo("Hello, world!"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/defaultmethod/HelloService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.defaultmethod; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.inject.Inject; 5 | 6 | @ApplicationScoped 7 | public class HelloService { 8 | @Inject 9 | @InterfaceBased 10 | private SimpleService service; 11 | 12 | public String hello() { 13 | return service.hello(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/defaultmethod/InterfaceBased.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.defaultmethod; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import jakarta.enterprise.util.AnnotationLiteral; 9 | import jakarta.inject.Qualifier; 10 | 11 | @Qualifier 12 | @Target(ElementType.FIELD) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface InterfaceBased { 15 | final class Literal extends AnnotationLiteral implements InterfaceBased { 16 | public static final Literal INSTANCE = new Literal(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/defaultmethod/RegisterInterfaceBased.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.defaultmethod; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.TYPE) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface RegisterInterfaceBased { 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/defaultmethod/SimpleService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.defaultmethod; 2 | 3 | import org.eclipse.microprofile.faulttolerance.Fallback; 4 | 5 | @RegisterInterfaceBased 6 | public interface SimpleService { 7 | @Fallback(fallbackMethod = "fallback") 8 | String hello(); 9 | 10 | default String fallback() { 11 | return "Hello, world!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallback/causechain/ExpectedOutcomeException.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallback.causechain; 2 | 3 | public class ExpectedOutcomeException extends Exception { 4 | public ExpectedOutcomeException() { 5 | } 6 | 7 | public ExpectedOutcomeException(Throwable cause) { 8 | super(cause); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallback/causechain/FallbackWithApplyOn.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallback.causechain; 2 | 3 | import java.io.IOException; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | 7 | import org.eclipse.microprofile.faulttolerance.Fallback; 8 | 9 | @ApplicationScoped 10 | public class FallbackWithApplyOn { 11 | @Fallback(fallbackMethod = "fallback", applyOn = IOException.class) 12 | public void hello(Exception e) throws Exception { 13 | throw e; 14 | } 15 | 16 | public void fallback(Exception ignored) { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallback/causechain/FallbackWithBothSkipOnAndApplyOn.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallback.causechain; 2 | 3 | import java.io.IOException; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | 7 | import org.eclipse.microprofile.faulttolerance.Fallback; 8 | 9 | @ApplicationScoped 10 | public class FallbackWithBothSkipOnAndApplyOn { 11 | @Fallback(fallbackMethod = "fallback", skipOn = ExpectedOutcomeException.class, applyOn = IOException.class) 12 | public void hello(Exception e) throws Exception { 13 | throw e; 14 | } 15 | 16 | public void fallback(Exception ignored) { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallback/causechain/FallbackWithSkipOn.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallback.causechain; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Fallback; 6 | 7 | @ApplicationScoped 8 | public class FallbackWithSkipOn { 9 | @Fallback(fallbackMethod = "fallback", skipOn = ExpectedOutcomeException.class) 10 | public void hello(Exception e) throws Exception { 11 | throw e; 12 | } 13 | 14 | public void fallback(Exception ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallback/handler/primitive/MyIntFallbackHandler.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallback.handler.primitive; 2 | 3 | import org.eclipse.microprofile.faulttolerance.ExecutionContext; 4 | import org.eclipse.microprofile.faulttolerance.FallbackHandler; 5 | 6 | public class MyIntFallbackHandler implements FallbackHandler { 7 | static boolean invoked = false; 8 | 9 | @Override 10 | public Integer handle(ExecutionContext executionContext) { 11 | invoked = true; 12 | return 42; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallback/handler/primitive/MyService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallback.handler.primitive; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Fallback; 6 | 7 | @ApplicationScoped 8 | public class MyService { 9 | @Fallback(MyVoidFallbackHandler.class) 10 | public void doSomething() { 11 | throw new RuntimeException(); 12 | } 13 | 14 | @Fallback(MyIntFallbackHandler.class) 15 | public int returnSomething() { 16 | throw new RuntimeException(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallback/handler/primitive/MyVoidFallbackHandler.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallback.handler.primitive; 2 | 3 | import org.eclipse.microprofile.faulttolerance.ExecutionContext; 4 | import org.eclipse.microprofile.faulttolerance.FallbackHandler; 5 | 6 | public class MyVoidFallbackHandler implements FallbackHandler { 7 | static boolean invoked = false; 8 | 9 | @Override 10 | public Void handle(ExecutionContext executionContext) { 11 | invoked = true; 12 | return null; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallbackmethod/exception/param/BasicService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallbackmethod.exception.param; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Fallback; 6 | 7 | @ApplicationScoped 8 | public class BasicService { 9 | @Fallback(fallbackMethod = "fallback") 10 | public String doSomething() { 11 | throw new IllegalArgumentException("hello"); 12 | } 13 | 14 | public String fallback(Exception e) { 15 | return e.getMessage(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallbackmethod/exception/param/GenericInterface.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallbackmethod.exception.param; 2 | 3 | public interface GenericInterface { 4 | String fallback(T param, IllegalArgumentException e); 5 | } 6 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallbackmethod/exception/param/GenericService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallbackmethod.exception.param; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | 5 | @ApplicationScoped 6 | public class GenericService extends GenericSuperclass { 7 | @Override 8 | public String fallback(String param, IllegalArgumentException e) { 9 | return e.getMessage(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallbackmethod/exception/param/GenericSuperclass.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallbackmethod.exception.param; 2 | 3 | import org.eclipse.microprofile.faulttolerance.Fallback; 4 | 5 | public abstract class GenericSuperclass implements GenericInterface { 6 | @Fallback(fallbackMethod = "fallback") 7 | public String doSomething(T param) { 8 | throw new IllegalArgumentException("hello"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallbackmethod/exception/param/VarargsService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallbackmethod.exception.param; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Fallback; 6 | 7 | @ApplicationScoped 8 | public class VarargsService { 9 | @Fallback(fallbackMethod = "fallback") 10 | public String doSomething(String str, int... intArray) { 11 | throw new IllegalArgumentException("hello " + intArray.length); 12 | } 13 | 14 | public String fallback(String str, int[] intArray, Exception e) { 15 | return e.getMessage(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallbackmethod/exception/param/invalid/InvalidService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallbackmethod.exception.param.invalid; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Fallback; 6 | 7 | @ApplicationScoped 8 | public class InvalidService { 9 | @Fallback(fallbackMethod = "fallback") 10 | public String doSomething() { 11 | throw new IllegalArgumentException("hello"); 12 | } 13 | 14 | public String fallback(String param, IllegalArgumentException e) { 15 | return e.getMessage(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallbackmethod/exception/param/invalid/generic/InvalidGenericService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallbackmethod.exception.param.invalid.generic; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | 5 | @ApplicationScoped 6 | public class InvalidGenericService extends InvalidGenericSuperclass { 7 | public String fallback(String param, IllegalArgumentException e) { 8 | return e.getMessage(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/fallbackmethod/exception/param/invalid/generic/InvalidGenericSuperclass.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.fallbackmethod.exception.param.invalid.generic; 2 | 3 | import org.eclipse.microprofile.faulttolerance.Fallback; 4 | 5 | public abstract class InvalidGenericSuperclass { 6 | @Fallback(fallbackMethod = "fallback") 7 | public String doSomething(T param) { 8 | throw new IllegalArgumentException("hello"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/metadata/BaseService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.metadata; 2 | 3 | import java.util.concurrent.atomic.AtomicInteger; 4 | 5 | import jakarta.enterprise.context.Dependent; 6 | 7 | import org.eclipse.microprofile.faulttolerance.Retry; 8 | 9 | @Dependent 10 | @Retry 11 | public class BaseService { 12 | 13 | static final AtomicInteger COUNTER = new AtomicInteger(0); 14 | 15 | public String retry() { 16 | if (COUNTER.incrementAndGet() == 5) { 17 | return "ok"; 18 | } 19 | throw new IllegalStateException(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/metadata/HelloService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.metadata; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | @Dependent 8 | @Retry(maxRetries = 4) 9 | public class HelloService extends BaseService { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/metadata/RetryOnSubclassOverrideTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.metadata; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 8 | 9 | /** 10 | * See also https://github.com/smallrye/smallrye-fault-tolerance/issues/20 11 | */ 12 | @FaultToleranceBasicTest 13 | public class RetryOnSubclassOverrideTest { 14 | @Test 15 | public void testRetryOverriden(HelloService helloService) { 16 | BaseService.COUNTER.set(0); 17 | assertThat(helloService.retry()).isEqualTo("ok"); 18 | // 1 + 4 retries 19 | assertThat(BaseService.COUNTER.get()).isEqualTo(5); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiBulkheadAsyncEventsTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneBulkheadAsyncEventsTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiBulkheadAsyncEventsTest extends StandaloneBulkheadAsyncEventsTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiBulkheadAsyncTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneBulkheadAsyncTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiBulkheadAsyncTest extends StandaloneBulkheadAsyncTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiBulkheadEventsTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneBulkheadEventsTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiBulkheadEventsTest extends StandaloneBulkheadEventsTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiBulkheadTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneBulkheadTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiBulkheadTest extends StandaloneBulkheadTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiCircuitBreakerAsyncEventsTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneCircuitBreakerAsyncEventsTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiCircuitBreakerAsyncEventsTest extends StandaloneCircuitBreakerAsyncEventsTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiCircuitBreakerAsyncTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneCircuitBreakerAsyncTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiCircuitBreakerAsyncTest extends StandaloneCircuitBreakerAsyncTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiCircuitBreakerEventsTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneCircuitBreakerEventsTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiCircuitBreakerEventsTest extends StandaloneCircuitBreakerEventsTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiCircuitBreakerMaintenanceTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneCircuitBreakerMaintenanceTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiCircuitBreakerMaintenanceTest extends StandaloneCircuitBreakerMaintenanceTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiCircuitBreakerTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneCircuitBreakerTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiCircuitBreakerTest extends StandaloneCircuitBreakerTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiFallbackAsyncTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneFallbackAsyncTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiFallbackAsyncTest extends StandaloneFallbackAsyncTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiFallbackTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneFallbackTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiFallbackTest extends StandaloneFallbackTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiPassthroughAsyncTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandalonePassthroughAsyncTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiPassthroughAsyncTest extends StandalonePassthroughAsyncTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiPassthroughTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandalonePassthroughTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiPassthroughTest extends StandalonePassthroughTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiRateLimitAsyncEventsTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneRateLimitAsyncEventsTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiRateLimitAsyncEventsTest extends StandaloneRateLimitAsyncEventsTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiRateLimitAsyncTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneRateLimitAsyncTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiRateLimitAsyncTest extends StandaloneRateLimitAsyncTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiRateLimitEventsTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneRateLimitEventsTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiRateLimitEventsTest extends StandaloneRateLimitEventsTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiRateLimitTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneRateLimitTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiRateLimitTest extends StandaloneRateLimitTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiRetryAsyncEventsTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneRetryAsyncEventsTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiRetryAsyncEventsTest extends StandaloneRetryAsyncEventsTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiRetryAsyncTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneRetryAsyncTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiRetryAsyncTest extends StandaloneRetryAsyncTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiRetryEventsTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneRetryEventsTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiRetryEventsTest extends StandaloneRetryEventsTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiRetryTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneRetryTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiRetryTest extends StandaloneRetryTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiThreadOffloadTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneThreadOffloadTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiThreadOffloadTest extends StandaloneThreadOffloadTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiTimeoutAsyncEventsTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneTimeoutAsyncEventsTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiTimeoutAsyncEventsTest extends StandaloneTimeoutAsyncEventsTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiTimeoutAsyncTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneTimeoutAsyncTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiTimeoutAsyncTest extends StandaloneTimeoutAsyncTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiTimeoutEventsTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneTimeoutEventsTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiTimeoutEventsTest extends StandaloneTimeoutEventsTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiTimeoutTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneTimeoutTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiTimeoutTest extends StandaloneTimeoutTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiUntypedAsyncGuardTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneUntypedAsyncGuardTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiUntypedAsyncGuardTest extends StandaloneUntypedAsyncGuardTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/programmatic/CdiUntypedGuardTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.programmatic; 2 | 3 | import io.smallrye.faulttolerance.standalone.test.StandaloneUntypedGuardTest; 4 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 5 | 6 | @FaultToleranceBasicTest 7 | public class CdiUntypedGuardTest extends StandaloneUntypedGuardTest { 8 | } 9 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/custom/TestBackoffStrategy.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.custom; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import io.smallrye.faulttolerance.api.CustomBackoffStrategy; 7 | 8 | public class TestBackoffStrategy implements CustomBackoffStrategy { 9 | static long initialDelay = -1; 10 | static List> exceptions = new ArrayList<>(); 11 | 12 | @Override 13 | public void init(long initialDelayInMillis) { 14 | initialDelay = initialDelayInMillis; 15 | } 16 | 17 | @Override 18 | public long nextDelayInMillis(Throwable exception) { 19 | exceptions.add(exception.getClass()); 20 | return 250; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/error/ClassAndMethodBackoffService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.error; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.ExponentialBackoff; 8 | import io.smallrye.faulttolerance.api.FibonacciBackoff; 9 | 10 | @Dependent 11 | @Retry 12 | @ExponentialBackoff 13 | public class ClassAndMethodBackoffService { 14 | @FibonacciBackoff 15 | public void hello() { 16 | throw new IllegalArgumentException(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/error/ClassAndMethodBackoffTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class ClassAndMethodBackoffTest { 13 | @Test 14 | public void test(ClassAndMethodBackoffService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/error/RetryOnClassBackoffOnMethodService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.error; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.ExponentialBackoff; 8 | 9 | @Dependent 10 | @Retry 11 | public class RetryOnClassBackoffOnMethodService { 12 | @ExponentialBackoff 13 | public void hello() { 14 | throw new IllegalArgumentException(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/error/RetryOnClassBackoffOnMethodTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class RetryOnClassBackoffOnMethodTest { 13 | @Test 14 | public void test(RetryOnClassBackoffOnMethodService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/error/RetryOnMethodBackoffOnClassService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.error; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.FibonacciBackoff; 8 | 9 | @Dependent 10 | @FibonacciBackoff 11 | public class RetryOnMethodBackoffOnClassService { 12 | @Retry 13 | public void hello() { 14 | throw new IllegalArgumentException(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/error/RetryOnMethodBackoffOnClassTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class RetryOnMethodBackoffOnClassTest { 13 | @Test 14 | public void test(RetryOnMethodBackoffOnClassService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/error/TwoBackoffsOnMethodService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.error; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.ExponentialBackoff; 8 | import io.smallrye.faulttolerance.api.FibonacciBackoff; 9 | 10 | @Dependent 11 | public class TwoBackoffsOnMethodService { 12 | @Retry 13 | @ExponentialBackoff 14 | @FibonacciBackoff 15 | public void hello() { 16 | throw new IllegalArgumentException(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/error/TwoBackoffsOnMethodTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class TwoBackoffsOnMethodTest { 13 | @Test 14 | public void test(TwoBackoffsOnMethodService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/exponential/error/MaxDelayEqualToMaxDurationService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.exponential.error; 2 | 3 | import java.time.temporal.ChronoUnit; 4 | 5 | import jakarta.enterprise.context.Dependent; 6 | 7 | import org.eclipse.microprofile.faulttolerance.Retry; 8 | 9 | import io.smallrye.faulttolerance.api.ExponentialBackoff; 10 | 11 | @Dependent 12 | public class MaxDelayEqualToMaxDurationService { 13 | @Retry(maxDuration = 1, durationUnit = ChronoUnit.MINUTES) 14 | @ExponentialBackoff(maxDelay = 1, maxDelayUnit = ChronoUnit.MINUTES) 15 | public void hello() { 16 | throw new IllegalArgumentException(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/exponential/error/MaxDelayEqualToMaxDurationTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.exponential.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class MaxDelayEqualToMaxDurationTest { 13 | @Test 14 | public void test(MaxDelayEqualToMaxDurationService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/exponential/error/MaxDelayGreaterThanMaxDurationService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.exponential.error; 2 | 3 | import java.time.temporal.ChronoUnit; 4 | 5 | import jakarta.enterprise.context.Dependent; 6 | 7 | import org.eclipse.microprofile.faulttolerance.Retry; 8 | 9 | import io.smallrye.faulttolerance.api.ExponentialBackoff; 10 | 11 | @Dependent 12 | public class MaxDelayGreaterThanMaxDurationService { 13 | @Retry(maxDuration = 1, durationUnit = ChronoUnit.MINUTES) 14 | @ExponentialBackoff(maxDelay = 2, maxDelayUnit = ChronoUnit.MINUTES) 15 | public void hello() { 16 | throw new IllegalArgumentException(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/exponential/error/MaxDelayGreaterThanMaxDurationTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.exponential.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class MaxDelayGreaterThanMaxDurationTest { 13 | @Test 14 | public void test(MaxDelayGreaterThanMaxDurationService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/exponential/error/NegativeFactorService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.exponential.error; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.ExponentialBackoff; 8 | 9 | @Dependent 10 | public class NegativeFactorService { 11 | @Retry 12 | @ExponentialBackoff(factor = -1) 13 | public void hello() { 14 | throw new IllegalArgumentException(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/exponential/error/NegativeFactorTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.exponential.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class NegativeFactorTest { 13 | @Test 14 | public void test(NegativeFactorService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/exponential/error/NegativeMaxDelayService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.exponential.error; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.ExponentialBackoff; 8 | 9 | @Dependent 10 | public class NegativeMaxDelayService { 11 | @Retry 12 | @ExponentialBackoff(maxDelay = -1) 13 | public void hello() { 14 | throw new IllegalArgumentException(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/exponential/error/NegativeMaxDelayTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.exponential.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class NegativeMaxDelayTest { 13 | @Test 14 | public void test(NegativeMaxDelayService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/exponential/error/ZeroFactorService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.exponential.error; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.ExponentialBackoff; 8 | 9 | @Dependent 10 | public class ZeroFactorService { 11 | @Retry 12 | @ExponentialBackoff(factor = 0) 13 | public void hello() { 14 | throw new IllegalArgumentException(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/exponential/error/ZeroFactorTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.exponential.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class ZeroFactorTest { 13 | @Test 14 | public void test(ZeroFactorService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/fibonacci/error/MaxDelayEqualToMaxDurationService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.fibonacci.error; 2 | 3 | import java.time.temporal.ChronoUnit; 4 | 5 | import jakarta.enterprise.context.Dependent; 6 | 7 | import org.eclipse.microprofile.faulttolerance.Retry; 8 | 9 | import io.smallrye.faulttolerance.api.FibonacciBackoff; 10 | 11 | @Dependent 12 | public class MaxDelayEqualToMaxDurationService { 13 | @Retry(maxDuration = 1, durationUnit = ChronoUnit.MINUTES) 14 | @FibonacciBackoff(maxDelay = 1, maxDelayUnit = ChronoUnit.MINUTES) 15 | public void hello() { 16 | throw new IllegalArgumentException(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/fibonacci/error/MaxDelayEqualToMaxDurationTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.fibonacci.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class MaxDelayEqualToMaxDurationTest { 13 | @Test 14 | public void test(MaxDelayEqualToMaxDurationService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/fibonacci/error/MaxDelayGreaterThanMaxDurationService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.fibonacci.error; 2 | 3 | import java.time.temporal.ChronoUnit; 4 | 5 | import jakarta.enterprise.context.Dependent; 6 | 7 | import org.eclipse.microprofile.faulttolerance.Retry; 8 | 9 | import io.smallrye.faulttolerance.api.FibonacciBackoff; 10 | 11 | @Dependent 12 | public class MaxDelayGreaterThanMaxDurationService { 13 | @Retry(maxDuration = 1, durationUnit = ChronoUnit.MINUTES) 14 | @FibonacciBackoff(maxDelay = 2, maxDelayUnit = ChronoUnit.MINUTES) 15 | public void hello() { 16 | throw new IllegalArgumentException(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/fibonacci/error/MaxDelayGreaterThanMaxDurationTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.fibonacci.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class MaxDelayGreaterThanMaxDurationTest { 13 | @Test 14 | public void test(MaxDelayGreaterThanMaxDurationService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/fibonacci/error/NegativeMaxDelayService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.fibonacci.error; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.FibonacciBackoff; 8 | 9 | @Dependent 10 | public class NegativeMaxDelayService { 11 | @Retry 12 | @FibonacciBackoff(maxDelay = -1) 13 | public void hello() { 14 | throw new IllegalArgumentException(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/backoff/fibonacci/error/NegativeMaxDelayTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.backoff.fibonacci.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class NegativeMaxDelayTest { 13 | @Test 14 | public void test(NegativeMaxDelayService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/beforeretry/BeforeRetryMethodTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.beforeretry; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | import static org.junit.jupiter.api.Assertions.assertThrows; 5 | 6 | import org.junit.jupiter.api.Test; 7 | 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | public class BeforeRetryMethodTest { 12 | @Test 13 | public void test(BeforeRetryMethodService service) { 14 | assertThrows(IllegalArgumentException.class, service::hello); 15 | assertThat(BeforeRetryMethodService.ids) 16 | .hasSize(3) 17 | .containsExactly(1, 2, 3); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/beforeretry/MyDependency.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.beforeretry; 2 | 3 | import java.util.concurrent.atomic.AtomicInteger; 4 | 5 | import jakarta.enterprise.context.Dependent; 6 | 7 | @Dependent 8 | public class MyDependency { 9 | private static final AtomicInteger counter = new AtomicInteger(); 10 | 11 | public final int id = counter.incrementAndGet(); 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/beforeretry/error/BothValueAndMethodNameSetTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.beforeretry.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class BothValueAndMethodNameSetTest { 13 | @Test 14 | public void test(BothValueAndMethodNameSetService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/beforeretry/error/NoBeforeRetryMethodFoundService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.beforeretry.error; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.BeforeRetry; 8 | 9 | @Dependent 10 | public class NoBeforeRetryMethodFoundService { 11 | @Retry 12 | @BeforeRetry(methodName = "beforeRetry") 13 | public void hello() { 14 | throw new IllegalArgumentException(); 15 | } 16 | 17 | public int beforeRetry(int param) { 18 | return 0; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/beforeretry/error/NoBeforeRetryMethodFoundTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.beforeretry.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class NoBeforeRetryMethodFoundTest { 13 | @Test 14 | public void test(NoBeforeRetryMethodFoundService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/beforeretry/error/RetryOnClassBeforeRetryOnMethodService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.beforeretry.error; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.BeforeRetry; 8 | 9 | @Dependent 10 | @Retry 11 | public class RetryOnClassBeforeRetryOnMethodService { 12 | @BeforeRetry(methodName = "beforeRetry") 13 | public void hello() { 14 | throw new IllegalArgumentException(); 15 | } 16 | 17 | void beforeRetry() { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/beforeretry/error/RetryOnClassBeforeRetryOnMethodTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.beforeretry.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class RetryOnClassBeforeRetryOnMethodTest { 13 | @Test 14 | public void test(RetryOnClassBeforeRetryOnMethodService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/beforeretry/error/RetryOnMethodBeforeRetryOnClassService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.beforeretry.error; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.BeforeRetry; 8 | 9 | @Dependent 10 | @BeforeRetry(methodName = "beforeRetry") 11 | public class RetryOnMethodBeforeRetryOnClassService { 12 | @Retry 13 | public void hello() { 14 | throw new IllegalArgumentException(); 15 | } 16 | 17 | void beforeRetry() { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/beforeretry/error/RetryOnMethodBeforeRetryOnClassTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.beforeretry.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class RetryOnMethodBeforeRetryOnClassTest { 13 | @Test 14 | public void test(RetryOnMethodBeforeRetryOnClassService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/stackoverflow/MyService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.stackoverflow; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Fallback; 6 | import org.eclipse.microprofile.faulttolerance.Retry; 7 | 8 | @Dependent 9 | public class MyService { 10 | @Retry(maxRetries = 10_000, jitter = 0) 11 | @Fallback(fallbackMethod = "fallback") 12 | public String hello() { 13 | throw new RuntimeException("force retry"); 14 | } 15 | 16 | public String fallback() { 17 | return "fallback"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/stackoverflow/RetryStackOverflowTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.stackoverflow; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 8 | 9 | @FaultToleranceBasicTest 10 | public class RetryStackOverflowTest { 11 | @Test 12 | public void test(MyService service) { 13 | assertEquals("fallback", service.hello()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/when/IsIllegalArgumentException.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.when; 2 | 3 | import java.util.function.Predicate; 4 | 5 | public class IsIllegalArgumentException implements Predicate { 6 | @Override 7 | public boolean test(Throwable throwable) { 8 | return throwable instanceof IllegalArgumentException; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/when/IsNull.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.when; 2 | 3 | import java.util.function.Predicate; 4 | 5 | public class IsNull implements Predicate { 6 | @Override 7 | public boolean test(Object o) { 8 | return o == null; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/when/both/RetryWhenResultAndExceptionTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.when.both; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 8 | 9 | @FaultToleranceBasicTest 10 | public class RetryWhenResultAndExceptionTest { 11 | @Test 12 | public void test(RetryWhenResultAndExceptionService service) { 13 | assertThat(service.hello()).isEqualTo("hello"); 14 | assertThat(service.getAttempts()).hasValue(3); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/when/error/RetryOnAndRetryWhenExceptionService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.when.error; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.RetryWhen; 8 | import io.smallrye.faulttolerance.retry.when.IsIllegalArgumentException; 9 | 10 | @ApplicationScoped 11 | public class RetryOnAndRetryWhenExceptionService { 12 | @Retry(retryOn = IllegalStateException.class) 13 | @RetryWhen(exception = IsIllegalArgumentException.class) 14 | public void hello() { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/when/error/RetryOnAndRetryWhenExceptionTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.when.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class RetryOnAndRetryWhenExceptionTest { 13 | @Test 14 | public void test(RetryOnAndRetryWhenExceptionService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/when/error/RetryOnClassRetryWhenOnMethodService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.when.error; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.RetryWhen; 8 | 9 | @Dependent 10 | @Retry 11 | public class RetryOnClassRetryWhenOnMethodService { 12 | @RetryWhen 13 | public void hello() { 14 | throw new IllegalArgumentException(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/when/error/RetryOnClassRetryWhenOnMethodTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.when.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class RetryOnClassRetryWhenOnMethodTest { 13 | @Test 14 | public void test(RetryOnClassRetryWhenOnMethodService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/when/error/RetryOnMethodRetryWhenOnClassService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.when.error; 2 | 3 | import jakarta.enterprise.context.Dependent; 4 | 5 | import org.eclipse.microprofile.faulttolerance.Retry; 6 | 7 | import io.smallrye.faulttolerance.api.RetryWhen; 8 | 9 | @Dependent 10 | @RetryWhen 11 | public class RetryOnMethodRetryWhenOnClassService { 12 | @Retry 13 | public void hello() { 14 | throw new IllegalArgumentException(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retry/when/error/RetryOnMethodRetryWhenOnClassTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retry.when.error; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class RetryOnMethodRetryWhenOnClassTest { 13 | @Test 14 | public void test(RetryOnMethodRetryWhenOnClassService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/retryonerror/HelloService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.retryonerror; 2 | 3 | import java.io.IOError; 4 | import java.util.concurrent.atomic.AtomicInteger; 5 | 6 | import jakarta.enterprise.context.ApplicationScoped; 7 | 8 | import org.eclipse.microprofile.faulttolerance.Retry; 9 | 10 | @ApplicationScoped 11 | public class HelloService { 12 | static final AtomicInteger COUNTER = new AtomicInteger(0); 13 | 14 | @Retry(maxRetries = 2, retryOn = Error.class) 15 | public String retry() { 16 | if (COUNTER.incrementAndGet() > 3) { 17 | return "ok"; 18 | } 19 | throw new IOError(null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/async/completionstage/MyService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.async.completionstage; 2 | 3 | import static java.util.concurrent.CompletableFuture.failedFuture; 4 | 5 | import java.util.concurrent.CompletionStage; 6 | import java.util.concurrent.atomic.AtomicInteger; 7 | 8 | import jakarta.enterprise.context.ApplicationScoped; 9 | 10 | import io.smallrye.faulttolerance.api.ApplyGuard; 11 | 12 | @ApplicationScoped 13 | public class MyService { 14 | static final AtomicInteger COUNTER = new AtomicInteger(0); 15 | 16 | @ApplyGuard("my-fault-tolerance") 17 | public CompletionStage hello() { 18 | COUNTER.incrementAndGet(); 19 | return failedFuture(new IllegalArgumentException()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/async/completionstage/fallback/guard/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.async.completionstage.fallback.guard; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(2).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/async/completionstage/threadoffload/guard/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.async.completionstage.threadoffload.guard; 2 | 3 | import jakarta.enterprise.inject.Produces; 4 | import jakarta.inject.Singleton; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @Singleton 10 | public class MyFaultTolerance { 11 | // not `static` to create a new instance for each Weld container in the test 12 | @Produces 13 | @Identifier("my-fault-tolerance") 14 | public final Guard GUARD = Guard.create() 15 | .withThreadOffload(true) 16 | .build(); 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/async/uni/MyService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.async.uni; 2 | 3 | import java.util.concurrent.atomic.AtomicInteger; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | 7 | import io.smallrye.faulttolerance.api.ApplyGuard; 8 | import io.smallrye.mutiny.Uni; 9 | 10 | @ApplicationScoped 11 | public class MyService { 12 | static final AtomicInteger COUNTER = new AtomicInteger(0); 13 | 14 | @ApplyGuard("my-fault-tolerance") 15 | public Uni hello() { 16 | COUNTER.incrementAndGet(); 17 | return Uni.createFrom().failure(new IllegalArgumentException()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/async/uni/ReuseAsyncUniTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.async.uni; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.jboss.weld.junit5.auto.AddBeanClasses; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @AddBeanClasses(MyFaultTolerance.class) 12 | public class ReuseAsyncUniTest { 13 | @Test 14 | public void test(MyService service) { 15 | assertThat(service.hello().await().indefinitely()).isEqualTo("fallback"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/async/uni/fallback/guard/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.async.uni.fallback.guard; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(2).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/async/uni/metrics/MyService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.async.uni.metrics; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | 5 | import io.smallrye.faulttolerance.api.ApplyGuard; 6 | import io.smallrye.mutiny.Uni; 7 | 8 | @ApplicationScoped 9 | public class MyService { 10 | @ApplyGuard("my-fault-tolerance") 11 | public Uni first() { 12 | return Uni.createFrom().failure(new IllegalArgumentException()); 13 | } 14 | 15 | @ApplyGuard("my-fault-tolerance") 16 | public Uni second() { 17 | return Uni.createFrom().failure(new IllegalStateException()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/async/uni/threadoffload/guard/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.async.uni.threadoffload.guard; 2 | 3 | import jakarta.enterprise.inject.Produces; 4 | import jakarta.inject.Singleton; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @Singleton 10 | public class MyFaultTolerance { 11 | // not `static` to create a new instance for each Weld container in the test 12 | @Produces 13 | @Identifier("my-fault-tolerance") 14 | public final Guard GUARD = Guard.create() 15 | .withThreadOffload(true) 16 | .build(); 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/guard/bulkhead/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.guard.bulkhead; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withBulkhead().limit(5).queueSize(5).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/guard/bulkhead/disable/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.guard.bulkhead.disable; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withBulkhead().limit(5).queueSize(5).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/guard/circuit/breaker/disable/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.guard.circuit.breaker.disable; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withCircuitBreaker().requestVolumeThreshold(3).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/guard/invalid/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.guard.invalid; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(2).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/guard/ratelimit/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.guard.ratelimit; 2 | 3 | import java.time.temporal.ChronoUnit; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | import jakarta.enterprise.inject.Produces; 7 | 8 | import io.smallrye.common.annotation.Identifier; 9 | import io.smallrye.faulttolerance.api.Guard; 10 | import io.smallrye.faulttolerance.api.RateLimitType; 11 | 12 | @ApplicationScoped 13 | public class MyFaultTolerance { 14 | @Produces 15 | @Identifier("my-fault-tolerance") 16 | public static final Guard GUARD = Guard.create() 17 | .withRateLimit().limit(50).window(20, ChronoUnit.SECONDS).type(RateLimitType.SMOOTH).done() 18 | .build(); 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/guard/retry/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.guard.retry; 2 | 3 | import java.time.temporal.ChronoUnit; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | import jakarta.enterprise.inject.Produces; 7 | 8 | import io.smallrye.common.annotation.Identifier; 9 | import io.smallrye.faulttolerance.api.Guard; 10 | 11 | @ApplicationScoped 12 | public class MyFaultTolerance { 13 | @Produces 14 | @Identifier("my-fault-tolerance") 15 | public static final Guard GUARD = Guard.create() 16 | .withRetry().maxRetries(2).delay(10, ChronoUnit.MILLIS).jitter(0, ChronoUnit.MILLIS) 17 | .retryOn(IllegalArgumentException.class).done() 18 | .build(); 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/guard/retry/disable/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.guard.retry.disable; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(2).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/guard/timeout/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.guard.timeout; 2 | 3 | import java.time.temporal.ChronoUnit; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | import jakarta.enterprise.inject.Produces; 7 | 8 | import io.smallrye.common.annotation.Identifier; 9 | import io.smallrye.faulttolerance.api.Guard; 10 | 11 | @ApplicationScoped 12 | public class MyFaultTolerance { 13 | @Produces 14 | @Identifier("my-fault-tolerance") 15 | public static final Guard GUARD = Guard.create() 16 | .withTimeout().duration(5, ChronoUnit.SECONDS).done() 17 | .build(); 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/guard/timeout/disable/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.guard.timeout.disable; 2 | 3 | import java.time.temporal.ChronoUnit; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | import jakarta.enterprise.inject.Produces; 7 | 8 | import io.smallrye.common.annotation.Identifier; 9 | import io.smallrye.faulttolerance.api.Guard; 10 | 11 | @ApplicationScoped 12 | public class MyFaultTolerance { 13 | @Produces 14 | @Identifier("my-fault-tolerance") 15 | public static final Guard GUARD = Guard.create() 16 | .withTimeout().duration(100, ChronoUnit.MILLIS).done() 17 | .build(); 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/typedguard/invalid/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.typedguard.invalid; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.TypedGuard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final TypedGuard GUARD = TypedGuard.create(String.class) 14 | .withRetry().maxRetries(2).done() 15 | .withFallback().handler(() -> "fallback").done() 16 | .build(); 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/typedguard/invalid/MyService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.typedguard.invalid; 2 | 3 | import java.util.concurrent.atomic.AtomicInteger; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | 7 | import io.smallrye.faulttolerance.api.ApplyGuard; 8 | 9 | @ApplicationScoped 10 | public class MyService { 11 | static final AtomicInteger COUNTER = new AtomicInteger(0); 12 | 13 | @ApplyGuard("my-fault-tolerance") 14 | public String hello() { 15 | COUNTER.incrementAndGet(); 16 | throw new IllegalStateException(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/typedguard/retry/MyService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.typedguard.retry; 2 | 3 | import java.util.concurrent.atomic.AtomicInteger; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | 7 | import io.smallrye.faulttolerance.api.ApplyGuard; 8 | 9 | @ApplicationScoped 10 | public class MyService { 11 | static final AtomicInteger COUNTER = new AtomicInteger(0); 12 | 13 | @ApplyGuard("my-fault-tolerance") 14 | public String hello() { 15 | COUNTER.incrementAndGet(); 16 | throw new IllegalStateException(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/typedguard/retry/disable/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.typedguard.retry.disable; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.TypedGuard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final TypedGuard GUARD = TypedGuard.create(String.class) 14 | .withRetry().maxRetries(2).done() 15 | .withFallback().handler(() -> "fallback").done() 16 | .build(); 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/config/typedguard/retry/disable/MyService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.config.typedguard.retry.disable; 2 | 3 | import java.util.concurrent.atomic.AtomicInteger; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | 7 | import io.smallrye.faulttolerance.api.ApplyGuard; 8 | 9 | @ApplicationScoped 10 | public class MyService { 11 | static final AtomicInteger COUNTER = new AtomicInteger(0); 12 | 13 | @ApplyGuard("my-fault-tolerance") 14 | public String hello() { 15 | COUNTER.incrementAndGet(); 16 | throw new IllegalArgumentException(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/errors/GuardWithIdentifierGlobalProducer.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.errors; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class GuardWithIdentifierGlobalProducer { 11 | @Produces 12 | @Identifier("global") 13 | public static Guard GUARD = Guard.create().build(); 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/errors/GuardWithIdentifierGlobalTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.errors; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class GuardWithIdentifierGlobalTest { 13 | @Test 14 | public void test(GuardWithIdentifierGlobalProducer ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/errors/MultipleGuardsWithSameIdentifierProducer.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.errors; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | import io.smallrye.faulttolerance.api.TypedGuard; 9 | 10 | @ApplicationScoped 11 | public class MultipleGuardsWithSameIdentifierProducer { 12 | @Produces 13 | @Identifier("foobar") 14 | public static Guard GUARD = Guard.create().build(); 15 | 16 | @Produces 17 | @Identifier("foobar") 18 | public static TypedGuard TYPED_GUARD = TypedGuard.create(String.class).build(); 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/errors/MultipleGuardsWithSameIdentifierTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.errors; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class MultipleGuardsWithSameIdentifierTest { 13 | @Test 14 | public void test(MultipleGuardsWithSameIdentifierProducer ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/errors/ReuseMissingService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.errors; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | 5 | import io.smallrye.faulttolerance.api.ApplyGuard; 6 | 7 | @ApplicationScoped 8 | public class ReuseMissingService { 9 | @ApplyGuard("my-fault-tolerance") 10 | public String hello() { 11 | return null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/errors/ReuseMissingTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.errors; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class ReuseMissingTest { 13 | @Test 14 | public void test(ReuseMissingService ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/errors/TypedGuardWithIdentifierGlobalProducer.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.errors; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.TypedGuard; 8 | 9 | @ApplicationScoped 10 | public class TypedGuardWithIdentifierGlobalProducer { 11 | @Produces 12 | @Identifier("global") 13 | public static TypedGuard GUARD = TypedGuard.create(String.class).build(); 14 | } 15 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/errors/TypedGuardWithIdentifierGlobalTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.errors; 2 | 3 | import jakarta.enterprise.inject.spi.DefinitionException; 4 | 5 | import org.junit.jupiter.api.Test; 6 | 7 | import io.smallrye.faulttolerance.util.ExpectedDeploymentException; 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @ExpectedDeploymentException(DefinitionException.class) 12 | public class TypedGuardWithIdentifierGlobalTest { 13 | @Test 14 | public void test(TypedGuardWithIdentifierGlobalProducer ignored) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/all/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.all; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(5).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/all/fallback/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.all.fallback; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(2).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/all/metrics/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.all.metrics; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(5).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/async/both/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.async.both; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(5).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/async/both/fallback/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.async.both.fallback; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(2).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/async/both/threadoffload/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.async.both.threadoffload; 2 | 3 | import jakarta.enterprise.inject.Produces; 4 | import jakarta.inject.Singleton; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @Singleton 10 | public class MyFaultTolerance { 11 | // not `static` to create a new instance for each Weld container in the test 12 | @Produces 13 | @Identifier("my-fault-tolerance") 14 | public final Guard GUARD = Guard.create() 15 | .withThreadOffload(true) 16 | .build(); 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/async/completionstage/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.async.completionstage; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(5).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/async/completionstage/fallback/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.async.completionstage.fallback; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(2).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/async/completionstage/threadoffload/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.async.completionstage.threadoffload; 2 | 3 | import jakarta.enterprise.inject.Produces; 4 | import jakarta.inject.Singleton; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @Singleton 10 | public class MyFaultTolerance { 11 | // not `static` to create a new instance for each Weld container in the test 12 | @Produces 13 | @Identifier("my-fault-tolerance") 14 | public final Guard GUARD = Guard.create() 15 | .withThreadOffload(true) 16 | .build(); 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/async/uni/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.async.uni; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(5).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/async/uni/fallback/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.async.uni.fallback; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(2).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/async/uni/threadoffload/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.async.uni.threadoffload; 2 | 3 | import jakarta.enterprise.inject.Produces; 4 | import jakarta.inject.Singleton; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @Singleton 10 | public class MyFaultTolerance { 11 | // not `static` to create a new instance for each Weld container in the test 12 | @Produces 13 | @Identifier("my-fault-tolerance") 14 | public final Guard GUARD = Guard.create() 15 | .withThreadOffload(true) 16 | .build(); 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/bulkhead/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.bulkhead; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withBulkhead().limit(3).queueSize(2).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/sync/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.sync; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(5).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/sync/fallback/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.sync.fallback; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(2).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/mixed/sync/threadoffload/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.mixed.sync.threadoffload; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withThreadOffload(true) 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/sync/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.sync; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.TypedGuard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final TypedGuard GUARD = TypedGuard.create(String.class) 14 | .withRetry().maxRetries(2).done() 15 | .withFallback().handler(() -> "fallback").done() 16 | .build(); 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/sync/MyService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.sync; 2 | 3 | import java.util.concurrent.atomic.AtomicInteger; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | 7 | import io.smallrye.faulttolerance.api.ApplyGuard; 8 | 9 | @ApplicationScoped 10 | public class MyService { 11 | static final AtomicInteger COUNTER = new AtomicInteger(0); 12 | 13 | @ApplyGuard("my-fault-tolerance") 14 | public String hello() { 15 | COUNTER.incrementAndGet(); 16 | throw new IllegalArgumentException(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/sync/ReuseSyncTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.sync; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.jboss.weld.junit5.auto.AddBeanClasses; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @AddBeanClasses(MyFaultTolerance.class) 12 | public class ReuseSyncTest { 13 | @Test 14 | public void test(MyService service) { 15 | assertThat(service.hello()).isEqualTo("fallback"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/sync/fallback/guard/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.sync.fallback.guard; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withRetry().maxRetries(2).done() 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/sync/fallback/guard/ReuseSyncFallbackGuardTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.sync.fallback.guard; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.jboss.weld.junit5.auto.AddBeanClasses; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @AddBeanClasses(MyFaultTolerance.class) 12 | public class ReuseSyncFallbackGuardTest { 13 | @Test 14 | public void test(MyService service) { 15 | assertThat(service.hello()).isEqualTo("better fallback"); 16 | assertThat(MyService.COUNTER).hasValue(3); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/sync/fallback/typedguard/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.sync.fallback.typedguard; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.TypedGuard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final TypedGuard GUARD = TypedGuard.create(String.class) 14 | .withRetry().maxRetries(2).done() 15 | .withFallback().handler(() -> "fallback").done() 16 | .build(); 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/sync/fallback/typedguard/ReuseSyncFallbackTypedGuardTest.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.sync.fallback.typedguard; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.jboss.weld.junit5.auto.AddBeanClasses; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest; 9 | 10 | @FaultToleranceBasicTest 11 | @AddBeanClasses(MyFaultTolerance.class) 12 | public class ReuseSyncFallbackTypedGuardTest { 13 | @Test 14 | public void test(MyService service) { 15 | assertThat(service.hello()).isEqualTo("better fallback"); 16 | assertThat(MyService.COUNTER).hasValue(3); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/sync/metrics/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.sync.metrics; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.TypedGuard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final TypedGuard GUARD = TypedGuard.create(String.class) 14 | .withRetry().maxRetries(2).done() 15 | .withFallback().handler(() -> "fallback").done() 16 | .build(); 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/sync/metrics/MyService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.sync.metrics; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | 5 | import io.smallrye.faulttolerance.api.ApplyGuard; 6 | 7 | @ApplicationScoped 8 | public class MyService { 9 | @ApplyGuard("my-fault-tolerance") 10 | public String first() { 11 | throw new IllegalArgumentException(); 12 | } 13 | 14 | @ApplyGuard("my-fault-tolerance") 15 | public String second() { 16 | throw new IllegalStateException(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/sync/threadoffload/guard/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.sync.threadoffload.guard; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.Guard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final Guard GUARD = Guard.create() 14 | .withThreadOffload(true) 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/sync/threadoffload/guard/MyService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.sync.threadoffload.guard; 2 | 3 | import java.util.concurrent.atomic.AtomicReference; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | 7 | import io.smallrye.faulttolerance.api.ApplyGuard; 8 | 9 | @ApplicationScoped 10 | public class MyService { 11 | static final AtomicReference CURRENT_THREAD = new AtomicReference<>(); 12 | 13 | @ApplyGuard("my-fault-tolerance") 14 | public String hello() { 15 | CURRENT_THREAD.set(Thread.currentThread()); 16 | return "hello"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/sync/threadoffload/typedguard/MyFaultTolerance.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.sync.threadoffload.typedguard; 2 | 3 | import jakarta.enterprise.context.ApplicationScoped; 4 | import jakarta.enterprise.inject.Produces; 5 | 6 | import io.smallrye.common.annotation.Identifier; 7 | import io.smallrye.faulttolerance.api.TypedGuard; 8 | 9 | @ApplicationScoped 10 | public class MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | public static final TypedGuard GUARD = TypedGuard.create(String.class) 14 | .withThreadOffload(true) 15 | .build(); 16 | } 17 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/reuse/sync/threadoffload/typedguard/MyService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.reuse.sync.threadoffload.typedguard; 2 | 3 | import java.util.concurrent.atomic.AtomicReference; 4 | 5 | import jakarta.enterprise.context.ApplicationScoped; 6 | 7 | import io.smallrye.faulttolerance.api.ApplyGuard; 8 | 9 | @ApplicationScoped 10 | public class MyService { 11 | static final AtomicReference CURRENT_THREAD = new AtomicReference<>(); 12 | 13 | @ApplyGuard("my-fault-tolerance") 14 | public String hello() { 15 | CURRENT_THREAD.set(Thread.currentThread()); 16 | return "hello"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/java/io/smallrye/faulttolerance/util/ExpectedDeploymentException.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.util; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.TYPE) 10 | public @interface ExpectedDeploymentException { 11 | Class value(); 12 | } 13 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/kotlin/io/smallrye/faulttolerance/kotlin/fallback/MyService.kt: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.kotlin.fallback 2 | 3 | import jakarta.enterprise.context.ApplicationScoped 4 | import kotlinx.coroutines.delay 5 | import org.eclipse.microprofile.faulttolerance.Fallback 6 | 7 | @ApplicationScoped 8 | open class MyService { 9 | @Fallback(fallbackMethod = "fallback") 10 | open suspend fun hello(name: String): String { 11 | delay(1000) 12 | throw IllegalArgumentException() 13 | } 14 | 15 | open suspend fun fallback(name: String, ex: Exception): String { 16 | delay(1000) 17 | return "Hello, ${name.uppercase()}" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/kotlin/io/smallrye/faulttolerance/kotlin/fallback/invalid/MyService.kt: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.kotlin.fallback.invalid 2 | 3 | import jakarta.enterprise.context.ApplicationScoped 4 | import kotlinx.coroutines.delay 5 | import org.eclipse.microprofile.faulttolerance.Fallback 6 | 7 | @ApplicationScoped 8 | open class MyService { 9 | @Fallback(fallbackMethod = "fallback") 10 | open suspend fun hello(name: String): String { 11 | throw IllegalArgumentException() 12 | } 13 | 14 | open suspend fun fallback(name: String, ex: Exception): Int { 15 | return 0 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/kotlin/io/smallrye/faulttolerance/kotlin/reuse/MyFaultTolerance.kt: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.kotlin.reuse 2 | 3 | import io.smallrye.common.annotation.Identifier 4 | import io.smallrye.faulttolerance.api.TypedGuard 5 | import jakarta.enterprise.context.ApplicationScoped 6 | import jakarta.enterprise.inject.Produces 7 | import java.util.function.Supplier 8 | 9 | @ApplicationScoped 10 | object MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | val GUARD = TypedGuard.create(String::class.java) 14 | .withRetry().maxRetries(2).done() 15 | .withFallback().handler(Supplier { "fallback" }).done() 16 | .build() 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/kotlin/io/smallrye/faulttolerance/kotlin/reuse/MyService.kt: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.kotlin.reuse 2 | 3 | import io.smallrye.faulttolerance.api.ApplyGuard 4 | import jakarta.enterprise.context.ApplicationScoped 5 | import kotlinx.coroutines.delay 6 | import java.util.concurrent.atomic.AtomicInteger 7 | 8 | @ApplicationScoped 9 | open class MyService { 10 | companion object { 11 | val COUNTER = AtomicInteger(0) 12 | } 13 | 14 | @ApplyGuard("my-fault-tolerance") 15 | open suspend fun hello(): String { 16 | COUNTER.incrementAndGet() 17 | delay(100) 18 | throw IllegalArgumentException() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/kotlin/io/smallrye/faulttolerance/kotlin/reuse/ReuseKotlinTest.kt: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.kotlin.reuse 2 | 3 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest 4 | import kotlinx.coroutines.runBlocking 5 | import org.assertj.core.api.Assertions.assertThat 6 | import org.jboss.weld.junit5.auto.AddBeanClasses 7 | import org.junit.jupiter.api.Test 8 | 9 | @FaultToleranceBasicTest 10 | @AddBeanClasses(MyFaultTolerance::class) 11 | class ReuseKotlinTest { 12 | @Test 13 | fun test(service: MyService) = runBlocking { 14 | assertThat(service.hello()).isEqualTo("fallback") 15 | assertThat(MyService.COUNTER).hasValue(3) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/kotlin/io/smallrye/faulttolerance/kotlin/reuse/fallback/guard/MyFaultTolerance.kt: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.kotlin.reuse.fallback.guard 2 | 3 | import io.smallrye.common.annotation.Identifier 4 | import io.smallrye.faulttolerance.api.Guard 5 | import jakarta.enterprise.context.ApplicationScoped 6 | import jakarta.enterprise.inject.Produces 7 | 8 | @ApplicationScoped 9 | object MyFaultTolerance { 10 | @Produces 11 | @Identifier("my-fault-tolerance") 12 | val GUARD = Guard.create() 13 | .withRetry().maxRetries(2).done() 14 | .build() 15 | } 16 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/kotlin/io/smallrye/faulttolerance/kotlin/reuse/fallback/guard/ReuseKotlinFallbackGuardTest.kt: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.kotlin.reuse.fallback.guard 2 | 3 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest 4 | import kotlinx.coroutines.runBlocking 5 | import org.assertj.core.api.Assertions.assertThat 6 | import org.jboss.weld.junit5.auto.AddBeanClasses 7 | import org.junit.jupiter.api.Test 8 | 9 | @FaultToleranceBasicTest 10 | @AddBeanClasses(MyFaultTolerance::class) 11 | class ReuseKotlinFallbackGuardTest { 12 | @Test 13 | fun test(service: MyService) = runBlocking { 14 | assertThat(service.hello()).isEqualTo("better fallback") 15 | assertThat(MyService.COUNTER).hasValue(3) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/kotlin/io/smallrye/faulttolerance/kotlin/reuse/fallback/typedguard/MyFaultTolerance.kt: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.kotlin.reuse.fallback.typedguard 2 | 3 | import io.smallrye.common.annotation.Identifier 4 | import io.smallrye.faulttolerance.api.TypedGuard 5 | import jakarta.enterprise.context.ApplicationScoped 6 | import jakarta.enterprise.inject.Produces 7 | import java.util.function.Supplier 8 | 9 | @ApplicationScoped 10 | object MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | val GUARD = TypedGuard.create(String::class.java) 14 | .withRetry().maxRetries(2).done() 15 | .withFallback().handler(Supplier { "fallback" }).done() 16 | .build() 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/kotlin/io/smallrye/faulttolerance/kotlin/reuse/fallback/typedguard/ReuseKotlinFallbackTypedGuardTest.kt: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.kotlin.reuse.fallback.typedguard 2 | 3 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest 4 | import kotlinx.coroutines.runBlocking 5 | import org.assertj.core.api.Assertions.assertThat 6 | import org.jboss.weld.junit5.auto.AddBeanClasses 7 | import org.junit.jupiter.api.Test 8 | 9 | @FaultToleranceBasicTest 10 | @AddBeanClasses(MyFaultTolerance::class) 11 | class ReuseKotlinFallbackTypedGuardTest { 12 | @Test 13 | fun test(service: MyService) = runBlocking { 14 | assertThat(service.hello()).isEqualTo("better fallback") 15 | assertThat(MyService.COUNTER).hasValue(3) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/kotlin/io/smallrye/faulttolerance/kotlin/reuse/metrics/MyFaultTolerance.kt: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.kotlin.reuse.metrics 2 | 3 | import io.smallrye.common.annotation.Identifier 4 | import io.smallrye.faulttolerance.api.TypedGuard 5 | import jakarta.enterprise.context.ApplicationScoped 6 | import jakarta.enterprise.inject.Produces 7 | import java.util.function.Supplier 8 | 9 | @ApplicationScoped 10 | object MyFaultTolerance { 11 | @Produces 12 | @Identifier("my-fault-tolerance") 13 | val GUARD = TypedGuard.create(String::class.java) 14 | .withRetry().maxRetries(2).done() 15 | .withFallback().handler(Supplier { "fallback" }).done() 16 | .build() 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/kotlin/io/smallrye/faulttolerance/kotlin/reuse/metrics/MyService.kt: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.kotlin.reuse.metrics 2 | 3 | import io.smallrye.faulttolerance.api.ApplyGuard 4 | import jakarta.enterprise.context.ApplicationScoped 5 | import kotlinx.coroutines.delay 6 | 7 | @ApplicationScoped 8 | open class MyService { 9 | @ApplyGuard("my-fault-tolerance") 10 | open suspend fun first(): String { 11 | delay(100) 12 | throw IllegalArgumentException() 13 | } 14 | 15 | @ApplyGuard("my-fault-tolerance") 16 | open suspend fun second(): String { 17 | delay(100) 18 | throw IllegalStateException() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/basic/src/test/kotlin/io/smallrye/faulttolerance/kotlin/timeout/KotlinTimeoutTest.kt: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.kotlin.timeout 2 | 3 | import io.smallrye.faulttolerance.util.FaultToleranceBasicTest 4 | import io.smallrye.faulttolerance.util.WithSystemProperty 5 | import kotlinx.coroutines.runBlocking 6 | import org.assertj.core.api.Assertions.assertThat 7 | import org.junit.jupiter.api.Test 8 | 9 | // so that FT methods don't have to be marked @AsynchronousNonBlocking 10 | @WithSystemProperty(key = "smallrye.faulttolerance.mp-compatibility", value = "false") 11 | @FaultToleranceBasicTest 12 | class KotlinTimeoutTest { 13 | @Test 14 | fun test(service: MyService) = runBlocking { 15 | val result = service.hello() 16 | assertThat(result).isEqualTo(42) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /testsuite/integration/src/test/java/io/smallrye/faulttolerance/TestAsyncExecutorProvider.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance; 2 | 3 | import java.util.concurrent.ExecutorService; 4 | 5 | import jakarta.annotation.Priority; 6 | import jakarta.enterprise.inject.Alternative; 7 | import jakarta.inject.Singleton; 8 | 9 | import org.eclipse.microprofile.context.ManagedExecutor; 10 | 11 | @Singleton 12 | @Alternative 13 | @Priority(1) 14 | public class TestAsyncExecutorProvider implements AsyncExecutorProvider { 15 | @Override 16 | public ExecutorService get() { 17 | return ManagedExecutor.builder().build(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /testsuite/integration/src/test/java/io/smallrye/faulttolerance/vertx/ExecutionStyle.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.vertx; 2 | 3 | public enum ExecutionStyle { 4 | EVENT_LOOP, 5 | WORKER, 6 | UNKNOWN, 7 | } 8 | -------------------------------------------------------------------------------- /testsuite/integration/src/test/java/io/smallrye/faulttolerance/vertx/retry/requestcontext/MyRequestScopedService.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.vertx.retry.requestcontext; 2 | 3 | import java.util.Queue; 4 | import java.util.concurrent.ConcurrentLinkedQueue; 5 | import java.util.concurrent.atomic.AtomicInteger; 6 | 7 | import jakarta.enterprise.context.RequestScoped; 8 | 9 | @RequestScoped 10 | public class MyRequestScopedService { 11 | static final Queue instanceIds = new ConcurrentLinkedQueue<>(); 12 | 13 | private static final AtomicInteger counter = new AtomicInteger(0); 14 | 15 | private final Integer id = counter.incrementAndGet(); 16 | 17 | public void call() { 18 | instanceIds.add(id); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /testsuite/tck/src/test/java/io/smallrye/faulttolerance/tck/OtelConfigExtension.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.tck; 2 | 3 | import jakarta.enterprise.event.Observes; 4 | import jakarta.enterprise.inject.spi.BeforeBeanDiscovery; 5 | import jakarta.enterprise.inject.spi.Extension; 6 | 7 | import io.smallrye.opentelemetry.implementation.config.OpenTelemetryConfigProducer; 8 | 9 | public class OtelConfigExtension implements Extension { 10 | public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) { 11 | bbd.addAnnotatedType(OpenTelemetryConfigProducer.class, OpenTelemetryConfigProducer.class.getName()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /testsuite/tck/src/test/java/io/smallrye/faulttolerance/tck/TckDeploymentExceptionTransformer.java: -------------------------------------------------------------------------------- 1 | package io.smallrye.faulttolerance.tck; 2 | 3 | import org.jboss.arquillian.container.spi.client.container.DeploymentExceptionTransformer; 4 | 5 | public class TckDeploymentExceptionTransformer implements DeploymentExceptionTransformer { 6 | @Override 7 | public Throwable transform(Throwable exception) { 8 | if (exception instanceof org.jboss.weld.exceptions.DefinitionException) { 9 | Throwable[] suppressed = exception.getSuppressed(); 10 | if (suppressed.length == 1) { 11 | return suppressed[0]; 12 | } 13 | } 14 | 15 | return null; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /testsuite/tck/src/test/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.tck.OtelConfigExtension 2 | -------------------------------------------------------------------------------- /testsuite/tck/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension: -------------------------------------------------------------------------------- 1 | io.smallrye.faulttolerance.tck.FaultToleranceExtension -------------------------------------------------------------------------------- /testsuite/tck/src/test/tck-suite-non-compatible.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /testsuite/tck/src/test/tck-suite.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | --------------------------------------------------------------------------------