diff options
author | Benjamin, Max <max.benjamin@att.com> | 2019-06-26 11:26:55 -0400 |
---|---|---|
committer | Max Benjamin <max.benjamin@att.com> | 2019-06-27 16:09:30 +0000 |
commit | 577bd39ac9e9495b0c6a38e6f7c567acfcba1c42 (patch) | |
tree | 267d3ce07458957189630ddf015338279256f2a6 /adapters | |
parent | 5c58eeca5ffd8b080b9af7619a903eb0acff3a0d (diff) |
Update failsafe dependency to 2.0.1
Updated calls to failsafe 2.0.1 API
Change-Id: I2c86ca02d56a07262e330ee5f8f088d1a1f5b4a7
Issue-ID: SO-2057
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters')
-rw-r--r-- | adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java | 11 |
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; } |