summaryrefslogtreecommitdiff
path: root/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/http/EaafHttpRequestRetryHandler.java
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2020-05-11 19:19:25 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2020-05-11 19:19:25 +0200
commitb5aeeac822bfe1a734835e3aa0caa65b56b3643a (patch)
tree502032aeba711a17d24aa16c67ac47e7041d8685 /eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/http/EaafHttpRequestRetryHandler.java
parentf5d3668fbc9f2e261185bbf110ddf867d7004b2a (diff)
downloadEAAF-Components-b5aeeac822bfe1a734835e3aa0caa65b56b3643a.tar.gz
EAAF-Components-b5aeeac822bfe1a734835e3aa0caa65b56b3643a.tar.bz2
EAAF-Components-b5aeeac822bfe1a734835e3aa0caa65b56b3643a.zip
update HttpClientFactory to facilitate request retrying in case of an error
Diffstat (limited to 'eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/http/EaafHttpRequestRetryHandler.java')
-rw-r--r--eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/http/EaafHttpRequestRetryHandler.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/http/EaafHttpRequestRetryHandler.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/http/EaafHttpRequestRetryHandler.java
new file mode 100644
index 00000000..3aa908e8
--- /dev/null
+++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/http/EaafHttpRequestRetryHandler.java
@@ -0,0 +1,33 @@
+package at.gv.egiz.eaaf.core.impl.http;
+
+import java.net.UnknownHostException;
+import java.util.Arrays;
+
+import javax.net.ssl.SSLException;
+
+import org.apache.http.client.HttpRequestRetryHandler;
+import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
+
+public class EaafHttpRequestRetryHandler extends DefaultHttpRequestRetryHandler implements
+ HttpRequestRetryHandler {
+
+ /**
+ * Create the request retry handler using the following list of non-retriable.
+ * IOException classes: <br>
+ * <ul>
+ * <li>UnknownHostException</li>
+ * <li>SSLException</li>
+ * </ul>
+ *
+ * @param retryCount how many times to retry; 0 means no retries
+ * @param requestSentRetryEnabled true if it's OK to retry non-idempotent
+ * requests that have been sent
+ */
+ public EaafHttpRequestRetryHandler(final int retryCount, final boolean requestSentRetryEnabled) {
+ super(retryCount, requestSentRetryEnabled, Arrays.asList(
+ UnknownHostException.class,
+ SSLException.class));
+
+ }
+
+}