From 577bd39ac9e9495b0c6a38e6f7c567acfcba1c42 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max" Date: Wed, 26 Jun 2019 11:26:55 -0400 Subject: 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) --- .../so/cloud/authentication/KeystoneV3Authentication.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'adapters/mso-adapter-utils') 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 createRetryPolicy() { List> result = new ArrayList<>(); result.add(e -> { return e.getCause() instanceof OpenStackResponseException @@ -102,10 +101,8 @@ public class KeystoneV3Authentication { }); Predicate 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 policy = new RetryPolicy().handleIf(error -> pred.test(error)) + .withDelay(Duration.ofSeconds(poConfig.getRetryDelay())).withMaxRetries(poConfig.getRetryCount()); return policy; } -- cgit 1.2.3-korg