Replace anonymous inner class with lambda
Change-Id: Ic9946466bf2ab702ce95c8ae4915cda649cbb5d6
diff --git a/src/main/java/com/ericsson/gerrit/plugins/syncindex/HttpClientProvider.java b/src/main/java/com/ericsson/gerrit/plugins/syncindex/HttpClientProvider.java
index 3b2f177..1e34a18 100644
--- a/src/main/java/com/ericsson/gerrit/plugins/syncindex/HttpClientProvider.java
+++ b/src/main/java/com/ericsson/gerrit/plugins/syncindex/HttpClientProvider.java
@@ -38,7 +38,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
import java.net.URI;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
@@ -90,24 +89,19 @@
}
private HttpRequestRetryHandler customRetryHandler() {
- return new HttpRequestRetryHandler() {
-
- @Override
- public boolean retryRequest(IOException exception, int executionCount,
- HttpContext context) {
- if (executionCount > cfg.getMaxTries()
- || exception instanceof SSLException) {
- return false;
- }
- logRetry(exception.getMessage());
- try {
- Thread.sleep(cfg.getRetryInterval());
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- return false;
- }
- return true;
+ return (exception, executionCount, context) -> {
+ if (executionCount > cfg.getMaxTries()
+ || exception instanceof SSLException) {
+ return false;
}
+ logRetry(exception.getMessage());
+ try {
+ Thread.sleep(cfg.getRetryInterval());
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ return false;
+ }
+ return true;
};
}