summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-06-27 18:23:42 +0000
committerGerrit Code Review <gerrit@onap.org>2019-06-27 18:23:42 +0000
commit205f358c6e06726de738b0c7706ec1c3c94afeaa (patch)
treeb57932da8fb3d00449c015c977ab3e06382ddef4 /adapters
parent53c9acdac34c8ae726d61d22b88fbe711597ea37 (diff)
parent577bd39ac9e9495b0c6a38e6f7c567acfcba1c42 (diff)
Merge "Update failsafe dependency to 2.0.1"
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
index 42d200a130..16906957a7 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
@@ -20,10 +20,10 @@
package org.onap.so.cloud.authentication;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import org.onap.so.config.beans.PoConfig;
import org.onap.so.db.catalog.beans.CloudIdentity;
@@ -89,8 +89,7 @@ public class KeystoneV3Authentication {
return result;
}
- protected RetryPolicy createRetryPolicy() {
- RetryPolicy policy = new RetryPolicy();
+ protected RetryPolicy<OpenStackResponse> createRetryPolicy() {
List<Predicate<Throwable>> result = new ArrayList<>();
result.add(e -> {
return e.getCause() instanceof OpenStackResponseException
@@ -102,10 +101,8 @@ public class KeystoneV3Authentication {
});
Predicate<Throwable> pred = result.stream().reduce(Predicate::or).orElse(x -> false);
-
- policy.retryOn(error -> pred.test(error));
-
- policy.withDelay(poConfig.getRetryDelay(), TimeUnit.SECONDS).withMaxRetries(poConfig.getRetryCount());
+ RetryPolicy<OpenStackResponse> policy = new RetryPolicy<OpenStackResponse>().handleIf(error -> pred.test(error))
+ .withDelay(Duration.ofSeconds(poConfig.getRetryDelay())).withMaxRetries(poConfig.getRetryCount());
return policy;
}