aboutsummaryrefslogtreecommitdiffstats
path: root/common/src/main
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2021-02-02 10:20:48 +0000
committerGerrit Code Review <gerrit@onap.org>2021-02-02 10:20:48 +0000
commitbe3f1c8d747ab7dad3d6c76dc4c9034e83b84635 (patch)
tree1b59f4d6d34ac7edc2c00ca28d6e8c00a9c298ad /common/src/main
parentd6194580f506ace2bf289eab17133c10ef912eed (diff)
parentb8b0464aa8a05a345115264084b08229f35c8413 (diff)
Merge "set connection timeout as well as read timeout"
Diffstat (limited to 'common/src/main')
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java3
-rw-r--r--common/src/main/java/org/onap/so/client/RestProperties.java9
2 files changed, 11 insertions, 1 deletions
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;
}