From b8b0464aa8a05a345115264084b08229f35c8413 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Sat, 23 Jan 2021 16:07:59 -0500 Subject: set connection timeout as well as read timeout set connection timeout as well as read timeout correct dependency version in openstack pom limit timeout test to a single retry add connection timeout property for A&AI client Issue-ID: SO-3491 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I576c143822ba45fc79648fd0a1edb6ccd3aff8b2 --- common/src/main/java/org/onap/so/client/RestClient.java | 3 ++- common/src/main/java/org/onap/so/client/RestProperties.java | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'common/src/main/java/org/onap') diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java index be0a0f3f9e..f201c7c906 100644 --- a/common/src/main/java/org/onap/so/client/RestClient.java +++ b/common/src/main/java/org/onap/so/client/RestClient.java @@ -193,7 +193,8 @@ public abstract class RestClient { if (props.isCachingEnabled()) { enableCaching(builder); } - return builder.readTimeout(props.getReadTimeout(), TimeUnit.MILLISECONDS); + return builder.connectTimeout(props.getConnectionTimeout(), TimeUnit.MILLISECONDS) + .readTimeout(props.getReadTimeout(), TimeUnit.MILLISECONDS); } protected ClientBuilder enableCaching(ClientBuilder builder) { diff --git a/common/src/main/java/org/onap/so/client/RestProperties.java b/common/src/main/java/org/onap/so/client/RestProperties.java index a7a0ef614c..79e006bf9a 100644 --- a/common/src/main/java/org/onap/so/client/RestProperties.java +++ b/common/src/main/java/org/onap/so/client/RestProperties.java @@ -50,6 +50,15 @@ public interface RestProperties { return Long.valueOf(60000); } + /** + * Time in milliseconds + * + * @return + */ + public default Long getConnectionTimeout() { + return Long.valueOf(60000); + } + public default boolean isCachingEnabled() { return false; } -- cgit 1.2.3-korg