Fixing README formatting, removing unused imports and changing logger attribute to final
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/f97f74ea Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/f97f74ea Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/f97f74ea Branch: refs/heads/master Commit: f97f74eaeadc44b0e0d4859c4797df77c6c5c5e5 Parents: 2057761 Author: Weverthon Medeiros <[email protected]> Authored: Fri Dec 21 14:54:48 2018 +0000 Committer: Weverthon Medeiros <[email protected]> Committed: Fri Dec 21 14:54:48 2018 +0000 ---------------------------------------------------------------------- examples/mp-faulttolerance-fallback/README.adoc | 26 +++++++++----------- .../rest/WeatherDayStatusFallbackHandler.java | 4 +-- .../java/org/superbiz/rest/WeatherService.java | 6 ++--- 3 files changed, 15 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/f97f74ea/examples/mp-faulttolerance-fallback/README.adoc ---------------------------------------------------------------------- diff --git a/examples/mp-faulttolerance-fallback/README.adoc b/examples/mp-faulttolerance-fallback/README.adoc index deba96b..ea5e599 100644 --- a/examples/mp-faulttolerance-fallback/README.adoc +++ b/examples/mp-faulttolerance-fallback/README.adoc @@ -1,32 +1,28 @@ -index-group=Unrevised -type=page -status=published -~~~~~~ -# Microprofile Fault Tolerance - Fallback += Microprofile Fault Tolerance - Fallback This is an example of how to use Microprofile @Fallback in TomEE. -#### Fallback Feature +== Fallback Feature Fault Tolerance Fallback provides an alternative execution in case of failure. This alternative will be called when `Retry` or `CircuitBreaker` has failed. -To use this feature you need to annotate the method with @Fallback. +To use this feature you need to annotate the method with `@Fallback`. The Fallback policy allows to configure : * **value**: A class which implements `FallbackHandler` * **fallbackMethod**: a method which will be executed. -The parameters **value** and **fallbackMethod** cannot be specified at the same time. +The parameters `value` and `fallbackMethod` cannot be specified at the same time. -Check the [specification](http://download.eclipse.org/microprofile/microprofile-fault-tolerance-1.1/microprofile-fault-tolerance-spec.html) for more details. +Check the http://download.eclipse.org/microprofile/microprofile-fault-tolerance-1.1/microprofile-fault-tolerance-spec.html[specification] for more details. -### Examples +== Examples -##### Run the application +=== Run the application mvn clean install tomee:run -##### Example 1 +=== Example 1 The method `statusOfDay` will always fail throwing a `WeatherException` and as the `@CircuitBreaker` annotation is configured to `failOn` in case of that exception, the fallback, @@ -69,7 +65,7 @@ Response Hi, today is a sunny day! ``` -##### Example 2 +=== Example 2 The method `statusOfDay` will always fail throwing a `WeatherException` and as the `@Retry` annotation is configured to `maxRetries = 1` in case of fail, the fallback method, @@ -111,9 +107,9 @@ Hi, week will be mostly sunny! ``` -##### Run the tests +=== Run the tests -You can also try it out using the [WeatherServiceTest.java](src/test/java/org/superbiz/rest/WeatherServiceTest.java) available in the project. +You can also try it out using the link:src/test/java/org/superbiz/rest/WeatherServiceTest.java[WeatherServiceTest.java] available in the project. mvn clean test http://git-wip-us.apache.org/repos/asf/tomee/blob/f97f74ea/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java ---------------------------------------------------------------------- diff --git a/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java index 8d9101b..a887b47 100644 --- a/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java +++ b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java @@ -24,11 +24,11 @@ import java.util.logging.Logger; public class WeatherDayStatusFallbackHandler implements FallbackHandler<String> { - private static Logger logger = Logger.getLogger(WeatherDayStatusFallbackHandler.class.getName()); + private static final Logger LOGGER = Logger.getLogger(WeatherDayStatusFallbackHandler.class.getName()); @Override public String handle(ExecutionContext executionContext) { - logger.log(Level.SEVERE, "Fallback was triggered due a fail"); + LOGGER.log(Level.SEVERE, "Fallback was triggered due a fail"); return "Hi, today is a sunny day!"; } } http://git-wip-us.apache.org/repos/asf/tomee/blob/f97f74ea/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java ---------------------------------------------------------------------- diff --git a/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java index 145b02e..1d1bf44 100644 --- a/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java +++ b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java @@ -24,12 +24,10 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.enterprise.context.RequestScoped; -import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; @Path("/weather") @@ -37,7 +35,7 @@ import javax.ws.rs.core.Response; @RequestScoped public class WeatherService { - private static Logger logger = Logger.getLogger(WeatherService.class.getName()); + private static final Logger LOGGER = Logger.getLogger(WeatherService.class.getName()); @GET @Path("/day/status") @@ -56,7 +54,7 @@ public class WeatherService { } public String fallbackForWeekStatus() { - logger.log(Level.SEVERE, "Fallback was triggered due a fail"); + LOGGER.log(Level.SEVERE, "Fallback was triggered due a fail"); return "Hi, week will be mostly sunny!"; } }
