Repository: tomee Updated Branches: refs/heads/master 5c047f803 -> a0e5348c8
Reverted Safeguard upgrade. It is failing the tests. Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/a0e5348c Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/a0e5348c Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/a0e5348c Branch: refs/heads/master Commit: a0e5348c8555174171a611c038d25ae179a287b3 Parents: 5c047f8 Author: Roberto Cortez <radcor...@yahoo.com> Authored: Wed Jan 2 12:04:11 2019 +0000 Committer: Roberto Cortez <radcor...@yahoo.com> Committed: Wed Jan 2 12:04:11 2019 +0000 ---------------------------------------------------------------------- pom.xml | 4 +- ...ilsafeContainerExecutionManagerProvider.java | 57 +++++++++++++++----- 2 files changed, 47 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/a0e5348c/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 03477b9..586eadf 100644 --- a/pom.xml +++ b/pom.xml @@ -203,7 +203,7 @@ <microprofile.jwt.impl.version>${project.version}</microprofile.jwt.impl.version> <!-- 1.1 Implementation not started yet --> <microprofile.fault-tolerance.version>1.0</microprofile.fault-tolerance.version> - <microprofile.fault-tolerance.impl.version>1.2.0</microprofile.fault-tolerance.impl.version> + <microprofile.fault-tolerance.impl.version>1.1-SNAPSHOT</microprofile.fault-tolerance.impl.version> <microprofile.health.version>1.0</microprofile.health.version> <microprofile.health.impl.version>1.0.1</microprofile.health.impl.version> <microprofile.metrics.version>1.1</microprofile.metrics.version> @@ -1850,4 +1850,4 @@ <url>scp://people.apache.org/www/tomee.apache.org/openejb/maven</url> </site> </distributionManagement> -</project> \ No newline at end of file +</project> http://git-wip-us.apache.org/repos/asf/tomee/blob/a0e5348c/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/faulttolerance/FailsafeContainerExecutionManagerProvider.java ---------------------------------------------------------------------- diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/faulttolerance/FailsafeContainerExecutionManagerProvider.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/faulttolerance/FailsafeContainerExecutionManagerProvider.java index baef59a..f0a9952 100644 --- a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/faulttolerance/FailsafeContainerExecutionManagerProvider.java +++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/faulttolerance/FailsafeContainerExecutionManagerProvider.java @@ -1,33 +1,66 @@ -package org.apache.tomee.microprofile.faulttolerance; -/** +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ +package org.apache.tomee.microprofile.faulttolerance; +import org.apache.safeguard.api.ExecutionManager; +import org.apache.safeguard.impl.FailsafeExecutionManager; +import org.apache.safeguard.impl.bulkhead.BulkheadManagerImpl; +import org.apache.safeguard.impl.cdi.FailsafeExecutionManagerProvider; +import org.apache.safeguard.impl.circuitbreaker.FailsafeCircuitBreakerManager; +import org.apache.safeguard.impl.config.MicroprofileAnnotationMapper; +import org.apache.safeguard.impl.executionPlans.ExecutionPlanFactory; +import org.apache.safeguard.impl.executorService.DefaultExecutorServiceProvider; +import org.apache.safeguard.impl.retry.FailsafeRetryManager; -import org.apache.safeguard.impl.customizable.Safeguard; - +import javax.annotation.Priority; import javax.annotation.Resource; import javax.enterprise.concurrent.ManagedScheduledExecutorService; import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.inject.Alternative; import javax.enterprise.inject.Produces; +import javax.enterprise.inject.Specializes; +import javax.interceptor.Interceptor; +@Alternative +@Priority(Interceptor.Priority.APPLICATION + 10) @ApplicationScoped -public class FailsafeContainerExecutionManagerProvider { - @Resource +public class FailsafeContainerExecutionManagerProvider extends FailsafeExecutionManagerProvider { + + @Resource(name = "DefaultManagedScheduledExecutorService") + ManagedScheduledExecutorService executor; + + @Override @Produces - @Safeguard - private ManagedScheduledExecutorService executor; -} \ No newline at end of file + @Specializes + @ApplicationScoped + public ExecutionManager createExecutionManager() { + final MicroprofileAnnotationMapper mapper = MicroprofileAnnotationMapper.getInstance(); + final DefaultExecutorServiceProvider executorServiceProvider = new DefaultExecutorServiceProvider(executor); + final BulkheadManagerImpl bulkheadManager = new BulkheadManagerImpl(); + final FailsafeCircuitBreakerManager circuitBreakerManager = new FailsafeCircuitBreakerManager(); + final FailsafeRetryManager retryManager = new FailsafeRetryManager(); + + return new FailsafeExecutionManager( + mapper, + bulkheadManager, + circuitBreakerManager, + retryManager, + new ExecutionPlanFactory(circuitBreakerManager, retryManager, bulkheadManager, mapper, + executorServiceProvider), + executorServiceProvider); + } +}