From 4ea00a9a4d90f1b23513128c10f4f93977ce06ac Mon Sep 17 00:00:00 2001 From: Michal Szynkiewicz Date: Fri, 20 Dec 2019 15:25:58 +0100 Subject: [PATCH 1/2] SmallRye FT 4.0.0 --- bom/runtime/pom.xml | 7 +- build-parent/pom.xml | 2 +- .../microprofile-fault-tolerance.adoc | 6 +- .../SmallRyeFaultToleranceProcessor.java | 99 +++---------------- .../substitutions/rxjava/UnsafeAccess.java | 14 --- .../smallrye-fault-tolerance/runtime/pom.xml | 8 +- .../runtime/HystrixInitializerStarter.java | 24 ----- .../SmallryeFaultToleranceRecorder.java | 23 ----- .../graal/FaultToleranceSubstitutions.java | 17 ---- tcks/microprofile-fault-tolerance/pom.xml | 6 -- .../smallrye/faulttolerance/Dummy.java | 6 ++ .../CustomTimeoutUninterruptableTest.java | 16 --- .../src/test/resources/application.properties | 1 + .../src/test/resources/config.properties | 14 --- 14 files changed, 34 insertions(+), 209 deletions(-) delete mode 100644 extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/substitutions/rxjava/UnsafeAccess.java delete mode 100644 extensions/smallrye-fault-tolerance/runtime/src/main/java/io/quarkus/smallrye/faulttolerance/runtime/HystrixInitializerStarter.java create mode 100644 tcks/microprofile-fault-tolerance/src/test/java/io/quarkus/smallrye/faulttolerance/Dummy.java delete mode 100644 tcks/microprofile-fault-tolerance/src/test/java/io/quarkus/tck/faulttolerance/CustomTimeoutUninterruptableTest.java create mode 100644 tcks/microprofile-fault-tolerance/src/test/resources/application.properties delete mode 100644 tcks/microprofile-fault-tolerance/src/test/resources/config.properties diff --git a/bom/runtime/pom.xml b/bom/runtime/pom.xml index 11a857d40cc45..9afdc05a0e939 100644 --- a/bom/runtime/pom.xml +++ b/bom/runtime/pom.xml @@ -36,7 +36,7 @@ 2.3.2 1.1.20 1.3.2 - 2.1.3 + 4.0.0 2.0.10 1.0.11 1.0.10 @@ -1239,6 +1239,11 @@ smallrye-fault-tolerance ${smallrye-fault-tolerance.version} + + io.smallrye + smallrye-fault-tolerance-context-propagation + ${smallrye-fault-tolerance.version} + io.smallrye smallrye-context-propagation diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 1696e01832d63..d6b44e31dfa3d 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -61,7 +61,7 @@ 2.1 1.3 2.2.1 - 2.0.2 + 2.0.3 1.0 1.3.4 1.1.2 diff --git a/docs/src/main/asciidoc/microprofile-fault-tolerance.adoc b/docs/src/main/asciidoc/microprofile-fault-tolerance.adoc index 9d66e2b794bce..4a3f9427aaa42 100644 --- a/docs/src/main/asciidoc/microprofile-fault-tolerance.adoc +++ b/docs/src/main/asciidoc/microprofile-fault-tolerance.adoc @@ -330,9 +330,9 @@ Check the server output to see that fallback is really happening: [source] ---- -2019-03-06 13:21:54,170 INFO [org.acm.fau.CoffeeResource] (pool-15-thread-3) CoffeeResource#recommendations() invocation #2 returning successfully -2019-03-06 13:21:55,159 ERROR [org.acm.fau.CoffeeResource] (pool-15-thread-4) CoffeeResource#recommendations() invocation #3 timed out after 248 ms -2019-03-06 13:21:55,161 INFO [org.acm.fau.CoffeeResource] (HystrixTimer-1) Falling back to RecommendationResource#fallbackRecommendations() +2020-01-09 13:21:34,250 INFO [org.acm.fau.CoffeeResource] (executor-thread-1) CoffeeResource#recommendations() invocation #1 returning successfully +2020-01-09 13:21:36,354 ERROR [org.acm.fau.CoffeeResource] (executor-thread-1) CoffeeResource#recommendations() invocation #2 timed out after 250 ms +2020-01-09 13:21:36,355 INFO [org.acm.fau.CoffeeResource] (executor-thread-1) Falling back to RecommendationResource#fallbackRecommendations() ---- NOTE: The fallback method is required to have the same parameters as the original method. diff --git a/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/SmallRyeFaultToleranceProcessor.java b/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/SmallRyeFaultToleranceProcessor.java index 89fe790d69d00..eccc5864d7ec9 100644 --- a/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/SmallRyeFaultToleranceProcessor.java +++ b/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/SmallRyeFaultToleranceProcessor.java @@ -20,30 +20,20 @@ import org.eclipse.microprofile.faulttolerance.FallbackHandler; import org.eclipse.microprofile.faulttolerance.Retry; import org.eclipse.microprofile.faulttolerance.Timeout; -import org.jboss.jandex.AnnotationInstance; -import org.jboss.jandex.AnnotationTarget; import org.jboss.jandex.AnnotationTarget.Kind; import org.jboss.jandex.AnnotationValue; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; import org.jboss.jandex.IndexView; -import org.jboss.jandex.Type; - -import com.netflix.hystrix.HystrixCircuitBreaker; import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.AnnotationsTransformerBuildItem; import io.quarkus.arc.deployment.BeanArchiveIndexBuildItem; -import io.quarkus.arc.deployment.BeanContainerBuildItem; import io.quarkus.arc.deployment.BeanDefiningAnnotationBuildItem; -import io.quarkus.arc.deployment.ObserverTransformerBuildItem; import io.quarkus.arc.deployment.ValidationPhaseBuildItem; -import io.quarkus.arc.processor.Annotations; import io.quarkus.arc.processor.AnnotationsTransformer; import io.quarkus.arc.processor.BeanInfo; import io.quarkus.arc.processor.BuiltinScope; -import io.quarkus.arc.processor.DotNames; -import io.quarkus.arc.processor.ObserverTransformer; import io.quarkus.deployment.Capabilities; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; @@ -52,27 +42,21 @@ import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.ConfigurationTypeBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; -import io.quarkus.deployment.builditem.ShutdownContextBuildItem; import io.quarkus.deployment.builditem.SystemPropertyBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageSystemPropertyBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; -import io.quarkus.deployment.logging.LogCleanupFilterBuildItem; -import io.quarkus.smallrye.faulttolerance.runtime.HystrixInitializerStarter; import io.quarkus.smallrye.faulttolerance.runtime.NoopMetricRegistry; import io.quarkus.smallrye.faulttolerance.runtime.QuarkusFallbackHandlerProvider; import io.quarkus.smallrye.faulttolerance.runtime.QuarkusFaultToleranceOperationProvider; import io.quarkus.smallrye.faulttolerance.runtime.SmallryeFaultToleranceRecorder; -import io.smallrye.faulttolerance.DefaultCommandListenersProvider; -import io.smallrye.faulttolerance.DefaultHystrixConcurrencyStrategy; -import io.smallrye.faulttolerance.HystrixCommandBinding; -import io.smallrye.faulttolerance.HystrixCommandInterceptor; -import io.smallrye.faulttolerance.HystrixInitializer; +import io.smallrye.faulttolerance.ExecutorProvider; +import io.smallrye.faulttolerance.FaultToleranceBinding; +import io.smallrye.faulttolerance.FaultToleranceInterceptor; +import io.smallrye.faulttolerance.internal.StrategyCache; import io.smallrye.faulttolerance.metrics.MetricsCollectorFactory; public class SmallRyeFaultToleranceProcessor { - static final DotName HYSTRIX_INITIALIZER_NAME = DotName.createSimple(HystrixInitializer.class.getName()); - @Inject BuildProducer reflectiveClass; @@ -82,16 +66,12 @@ public class SmallRyeFaultToleranceProcessor { @Inject CombinedIndexBuildItem combinedIndexBuildItem; - NativeImageSystemPropertyBuildItem disableJmx() { - return new NativeImageSystemPropertyBuildItem("archaius.dynamicPropertyFactory.registerConfigWithJMX", "false"); - } - @BuildStep public void build(BuildProducer annotationsTransformer, BuildProducer feature, BuildProducer additionalBean, BuildProducer additionalBda, Capabilities capabilities, - BuildProducer systemProperty) throws Exception { + BuildProducer systemProperty) { feature.produce(new FeatureBuildItem(FeatureBuildItem.SMALLRYE_FAULT_TOLERANCE)); @@ -124,7 +104,6 @@ public void build(BuildProducer annotationsTran additionalBean.produce(fallbackHandlersBeans.build()); } - reflectiveClass.produce(new ReflectiveClassBuildItem(false, true, HystrixCircuitBreaker.Factory.class.getName())); for (DotName annotation : ftAnnotations) { reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, annotation.toString())); // also make them bean defining annotations @@ -141,7 +120,7 @@ public boolean appliesTo(Kind kind) { @Override public void transform(TransformationContext context) { if (ftAnnotations.contains(context.getTarget().asClass().name())) { - context.transform().add(HystrixCommandBinding.class).done(); + context.transform().add(FaultToleranceBinding.class).done(); } } })); @@ -153,12 +132,12 @@ public void transform(TransformationContext context) { for (DotName ftAnnotation : ftAnnotations) { builder.addBeanClass(ftAnnotation.toString()); } - builder.addBeanClasses(HystrixCommandInterceptor.class, HystrixInitializer.class, - DefaultHystrixConcurrencyStrategy.class, - QuarkusFaultToleranceOperationProvider.class, QuarkusFallbackHandlerProvider.class, - DefaultCommandListenersProvider.class, - MetricsCollectorFactory.class, - HystrixInitializerStarter.class); + builder.addBeanClasses(FaultToleranceInterceptor.class, + ExecutorProvider.class, + StrategyCache.class, + QuarkusFaultToleranceOperationProvider.class, + QuarkusFallbackHandlerProvider.class, + MetricsCollectorFactory.class); additionalBean.produce(builder.build()); if (!capabilities.isCapabilityPresent(Capabilities.METRICS)) { @@ -173,15 +152,15 @@ public void transform(TransformationContext context) { AnnotationsTransformerBuildItem transformInterceptorPriority(BeanArchiveIndexBuildItem index) { return new AnnotationsTransformerBuildItem(new AnnotationsTransformer() { @Override - public boolean appliesTo(AnnotationTarget.Kind kind) { - return kind == org.jboss.jandex.AnnotationTarget.Kind.CLASS; + public boolean appliesTo(Kind kind) { + return kind == Kind.CLASS; } @Override public void transform(TransformationContext ctx) { if (ctx.isClass()) { if (!ctx.getTarget().asClass().name().toString() - .equals("io.smallrye.faulttolerance.HystrixCommandInterceptor")) { + .equals("io.smallrye.faulttolerance.FaultToleranceInterceptor")) { return; } final Config config = ConfigProvider.getConfig(); @@ -214,52 +193,4 @@ void validateFaultToleranceAnnotations( public ConfigurationTypeBuildItem registerTypes() { return new ConfigurationTypeBuildItem(ChronoUnit.class); } - - @BuildStep - public void logCleanup(BuildProducer logCleanupFilter) { - logCleanupFilter.produce(new LogCleanupFilterBuildItem("io.smallrye.faulttolerance.HystrixInitializer", - "### Init Hystrix ###", - "### Reset Hystrix ###", - // no need to log the strategy if it is the default - "Hystrix concurrency strategy used: DefaultHystrixConcurrencyStrategy")); - logCleanupFilter.produce(new LogCleanupFilterBuildItem("io.smallrye.faulttolerance.DefaultHystrixConcurrencyStrategy", - "### Privilleged Thread Factory used ###")); - - logCleanupFilter.produce(new LogCleanupFilterBuildItem("com.netflix.config.sources.URLConfigurationSource", - "No URLs will be polled as dynamic configuration sources.", - "To enable URLs as dynamic configuration sources")); - logCleanupFilter.produce(new LogCleanupFilterBuildItem("com.netflix.config.DynamicPropertyFactory", - "DynamicPropertyFactory is initialized with configuration sources")); - } - - @Record(ExecutionTime.STATIC_INIT) - @BuildStep - public void clearStatic(SmallryeFaultToleranceRecorder recorder, ShutdownContextBuildItem context, - BeanContainerBuildItem beanContainer) { - // impl note - we depend on BeanContainerBuildItem to make sure Arc registers before SR FT - // this is needed so that shutdown context of FT is executed before Arc container shuts down - recorder.resetCommandContextOnUndeploy(context); - } - - @BuildStep - ObserverTransformerBuildItem vetoHystrixInitializerObserver() { - return new ObserverTransformerBuildItem(new ObserverTransformer() { - - @Override - public boolean appliesTo(Type observedType, Set qualifiers) { - AnnotationInstance initialized = Annotations.find(Annotations.getParameterAnnotations(qualifiers), - DotNames.INITIALIZED); - return initialized != null ? initialized.value().asClass().name().equals(BuiltinScope.APPLICATION.getName()) - : false; - } - - @Override - public void transform(TransformationContext context) { - if (context.getMethod().declaringClass().name().equals(HYSTRIX_INITIALIZER_NAME)) { - context.veto(); - } - } - - }); - } } diff --git a/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/substitutions/rxjava/UnsafeAccess.java b/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/substitutions/rxjava/UnsafeAccess.java deleted file mode 100644 index 5f4fba111b36e..0000000000000 --- a/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/substitutions/rxjava/UnsafeAccess.java +++ /dev/null @@ -1,14 +0,0 @@ -package io.quarkus.smallrye.faulttolerance.deployment.substitutions.rxjava; - -import com.oracle.svm.core.annotate.Substitute; -import com.oracle.svm.core.annotate.TargetClass; - -@TargetClass(className = "rx.internal.util.unsafe.UnsafeAccess") -public final class UnsafeAccess { - - @Substitute - public static boolean isUnsafeAvailable() { - return false; - } - -} diff --git a/extensions/smallrye-fault-tolerance/runtime/pom.xml b/extensions/smallrye-fault-tolerance/runtime/pom.xml index 53da9a7c4edd1..49c5035b3ea99 100644 --- a/extensions/smallrye-fault-tolerance/runtime/pom.xml +++ b/extensions/smallrye-fault-tolerance/runtime/pom.xml @@ -59,13 +59,9 @@ io.smallrye - smallrye-context-propagation-propagators-rxjava1 - - - - io.reactivex - rxjava + smallrye-fault-tolerance-context-propagation + diff --git a/extensions/smallrye-fault-tolerance/runtime/src/main/java/io/quarkus/smallrye/faulttolerance/runtime/HystrixInitializerStarter.java b/extensions/smallrye-fault-tolerance/runtime/src/main/java/io/quarkus/smallrye/faulttolerance/runtime/HystrixInitializerStarter.java deleted file mode 100644 index d8e29a2186c0e..0000000000000 --- a/extensions/smallrye-fault-tolerance/runtime/src/main/java/io/quarkus/smallrye/faulttolerance/runtime/HystrixInitializerStarter.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.quarkus.smallrye.faulttolerance.runtime; - -import javax.enterprise.context.Dependent; -import javax.enterprise.event.Observes; - -import io.quarkus.runtime.StartupEvent; -import io.smallrye.faulttolerance.HystrixInitializer; - -@Dependent -public class HystrixInitializerStarter { - - /** - * This is a replacement for io.smallrye.faulttolerance.HystrixInitializer.init(Object) observer method which - * is vetoed because we don't want initialize Hystrix during static init. - * - * @param event - * @param initializer - */ - void startup(@Observes StartupEvent event, HystrixInitializer initializer) { - // HystrixInitializer is a normal scoped bean so we have to invoke a method upon the injected proxy to force the instantiation - initializer.toString(); - } - -} diff --git a/extensions/smallrye-fault-tolerance/runtime/src/main/java/io/quarkus/smallrye/faulttolerance/runtime/SmallryeFaultToleranceRecorder.java b/extensions/smallrye-fault-tolerance/runtime/src/main/java/io/quarkus/smallrye/faulttolerance/runtime/SmallryeFaultToleranceRecorder.java index 1b64151e6d190..72c3d8bcc6191 100644 --- a/extensions/smallrye-fault-tolerance/runtime/src/main/java/io/quarkus/smallrye/faulttolerance/runtime/SmallryeFaultToleranceRecorder.java +++ b/extensions/smallrye-fault-tolerance/runtime/src/main/java/io/quarkus/smallrye/faulttolerance/runtime/SmallryeFaultToleranceRecorder.java @@ -10,35 +10,12 @@ import org.eclipse.microprofile.faulttolerance.exceptions.FaultToleranceDefinitionException; -import com.netflix.hystrix.Hystrix; -import com.netflix.hystrix.metric.HystrixCollapserEventStream; -import com.netflix.hystrix.metric.HystrixCommandCompletionStream; -import com.netflix.hystrix.metric.HystrixCommandStartStream; -import com.netflix.hystrix.metric.HystrixThreadEventStream; -import com.netflix.hystrix.metric.HystrixThreadPoolCompletionStream; - -import io.quarkus.runtime.ShutdownContext; import io.quarkus.runtime.annotations.Recorder; import io.smallrye.faulttolerance.config.FaultToleranceOperation; @Recorder public class SmallryeFaultToleranceRecorder { - public void resetCommandContextOnUndeploy(ShutdownContext context) { - context.addShutdownTask(new Runnable() { - @Override - public void run() { - HystrixCommandCompletionStream.reset(); - HystrixCollapserEventStream.reset(); - HystrixCommandStartStream.reset(); - HystrixThreadPoolCompletionStream.reset(); - HystrixCommandStartStream.reset(); - HystrixThreadEventStream.getInstance().shutdown(); - Hystrix.reset(); - } - }); - } - public void validate(List beanNames) { List allExceptions = new ArrayList<>(); for (String beanName : beanNames) { diff --git a/extensions/smallrye-fault-tolerance/runtime/src/main/java/io/quarkus/smallrye/faulttolerance/runtime/graal/FaultToleranceSubstitutions.java b/extensions/smallrye-fault-tolerance/runtime/src/main/java/io/quarkus/smallrye/faulttolerance/runtime/graal/FaultToleranceSubstitutions.java index 1126df66fea49..e5aa9b8c78987 100644 --- a/extensions/smallrye-fault-tolerance/runtime/src/main/java/io/quarkus/smallrye/faulttolerance/runtime/graal/FaultToleranceSubstitutions.java +++ b/extensions/smallrye-fault-tolerance/runtime/src/main/java/io/quarkus/smallrye/faulttolerance/runtime/graal/FaultToleranceSubstitutions.java @@ -3,29 +3,12 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import org.apache.commons.configuration.AbstractConfiguration; - -import com.netflix.config.jmx.ConfigMBean; import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; public class FaultToleranceSubstitutions { } -@TargetClass(className = "com.netflix.config.jmx.ConfigJMXManager") -final class Target_com_netflix_config_jmx_ConfigJMXManager { - - @Substitute - public static ConfigMBean registerConfigMbean(AbstractConfiguration config) { - return null; - } - - @Substitute - public static void unRegisterConfigMBean(AbstractConfiguration config, ConfigMBean mbean) { - - } -} - @TargetClass(className = "io.smallrye.faulttolerance.DefaultMethodFallbackProvider") final class Target_io_smallrye_faulttolerance_DefaultMethodFallbackProvider { diff --git a/tcks/microprofile-fault-tolerance/pom.xml b/tcks/microprofile-fault-tolerance/pom.xml index a41101697c0c7..bc6845297859d 100644 --- a/tcks/microprofile-fault-tolerance/pom.xml +++ b/tcks/microprofile-fault-tolerance/pom.xml @@ -21,7 +21,6 @@ false - true @@ -33,11 +32,6 @@ org.eclipse.microprofile.fault.tolerance.tck.interceptor.xmlInterceptorEnabling.FaultToleranceInterceptorEnableByXmlTest - - - - - org.eclipse.microprofile.fault.tolerance.tck.TimeoutUninterruptableTest diff --git a/tcks/microprofile-fault-tolerance/src/test/java/io/quarkus/smallrye/faulttolerance/Dummy.java b/tcks/microprofile-fault-tolerance/src/test/java/io/quarkus/smallrye/faulttolerance/Dummy.java new file mode 100644 index 0000000000000..9732d63dcab05 --- /dev/null +++ b/tcks/microprofile-fault-tolerance/src/test/java/io/quarkus/smallrye/faulttolerance/Dummy.java @@ -0,0 +1,6 @@ +package io.quarkus.smallrye.faulttolerance; + +// We need this class so that target/test-classes is added to the class path? +public class Dummy { + +} \ No newline at end of file diff --git a/tcks/microprofile-fault-tolerance/src/test/java/io/quarkus/tck/faulttolerance/CustomTimeoutUninterruptableTest.java b/tcks/microprofile-fault-tolerance/src/test/java/io/quarkus/tck/faulttolerance/CustomTimeoutUninterruptableTest.java deleted file mode 100644 index dbe0a19f88b7a..0000000000000 --- a/tcks/microprofile-fault-tolerance/src/test/java/io/quarkus/tck/faulttolerance/CustomTimeoutUninterruptableTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package io.quarkus.tck.faulttolerance; - -import org.eclipse.microprofile.fault.tolerance.tck.TimeoutUninterruptableTest; -import org.testng.annotations.Test; - -/** - * Customized test from MP FT TCK because `testTimeout` fails because Hystrix is unable to interrupt the calling thread, as it - * didn't create it. - * https://github.com/eclipse/microprofile-fault-tolerance/issues/408 - */ -public class CustomTimeoutUninterruptableTest extends TimeoutUninterruptableTest { - - @Test(enabled = false) - public void testTimeout() { - } -} diff --git a/tcks/microprofile-fault-tolerance/src/test/resources/application.properties b/tcks/microprofile-fault-tolerance/src/test/resources/application.properties new file mode 100644 index 0000000000000..d657f42668774 --- /dev/null +++ b/tcks/microprofile-fault-tolerance/src/test/resources/application.properties @@ -0,0 +1 @@ +io.smallrye.faulttolerance.globalThreadPoolSize=1000 \ No newline at end of file diff --git a/tcks/microprofile-fault-tolerance/src/test/resources/config.properties b/tcks/microprofile-fault-tolerance/src/test/resources/config.properties deleted file mode 100644 index 81105bec83b04..0000000000000 --- a/tcks/microprofile-fault-tolerance/src/test/resources/config.properties +++ /dev/null @@ -1,14 +0,0 @@ -# Used in BulkheadFallbackRejectTest -hystrix.command.default.fallback.isolation.semaphore.maxConcurrentRequests=50 - -# Needed for extreme load in some bulkhead tests -hystrix.threadpool.default.allowMaximumSizeToDivergeFromCoreSize=true -hystrix.threadpool.default.maximumSize=40 - -# Do not interrupt command execution when a timeout occurs - needed for bulkhead tests -hystrix.command.default.execution.isolation.thread.interruptOnTimeout=false - -# Async actions don't have a timeout by default (because MP FT spec doesn't require it), but we define one -# to make sure tests don't hang (the io_smallrye_faulttolerance_asyncTimeout config property must be set to true) -# Of course the timeout value needs to be high enough -- some tests require at least 20 seconds -hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=60000 \ No newline at end of file From bc97f641a66f372b8e1590a9c4a98b9315a19126 Mon Sep 17 00:00:00 2001 From: Michal Szynkiewicz Date: Thu, 16 Jan 2020 11:43:09 +0100 Subject: [PATCH 2/2] SmallRye FT 4.0.0: added service provider for CP executor factory --- .../deployment/SmallRyeFaultToleranceProcessor.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/SmallRyeFaultToleranceProcessor.java b/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/SmallRyeFaultToleranceProcessor.java index eccc5864d7ec9..81cae51660a3c 100644 --- a/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/SmallRyeFaultToleranceProcessor.java +++ b/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/SmallRyeFaultToleranceProcessor.java @@ -45,15 +45,18 @@ import io.quarkus.deployment.builditem.SystemPropertyBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageSystemPropertyBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; +import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; import io.quarkus.smallrye.faulttolerance.runtime.NoopMetricRegistry; import io.quarkus.smallrye.faulttolerance.runtime.QuarkusFallbackHandlerProvider; import io.quarkus.smallrye.faulttolerance.runtime.QuarkusFaultToleranceOperationProvider; import io.quarkus.smallrye.faulttolerance.runtime.SmallryeFaultToleranceRecorder; +import io.smallrye.faulttolerance.ExecutorFactory; import io.smallrye.faulttolerance.ExecutorProvider; import io.smallrye.faulttolerance.FaultToleranceBinding; import io.smallrye.faulttolerance.FaultToleranceInterceptor; import io.smallrye.faulttolerance.internal.StrategyCache; import io.smallrye.faulttolerance.metrics.MetricsCollectorFactory; +import io.smallrye.faulttolerance.propagation.ContextPropagationExecutorFactory; public class SmallRyeFaultToleranceProcessor { @@ -69,12 +72,16 @@ public class SmallRyeFaultToleranceProcessor { @BuildStep public void build(BuildProducer annotationsTransformer, BuildProducer feature, BuildProducer additionalBean, + BuildProducer serviceProvider, BuildProducer additionalBda, Capabilities capabilities, BuildProducer systemProperty) { feature.produce(new FeatureBuildItem(FeatureBuildItem.SMALLRYE_FAULT_TOLERANCE)); + serviceProvider.produce(new ServiceProviderBuildItem(ExecutorFactory.class.getName(), + ContextPropagationExecutorFactory.class.getName())); + Set ftAnnotations = new HashSet<>(); ftAnnotations.add(DotName.createSimple(Asynchronous.class.getName())); ftAnnotations.add(DotName.createSimple(Bulkhead.class.getName()));