diff options
author | Joseph Keenan <joseph.keenan@est.tech> | 2022-08-18 11:23:19 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-08-18 11:23:19 +0000 |
commit | 06dc882a49e6754f68ff626f246cfbe3136305af (patch) | |
tree | b95e58c443635d8b596f6adb6b9cf92861a39218 | |
parent | daaaa1080d08f9e076ca6f7be61010ab1db61f66 (diff) | |
parent | 6cd3d9c541abfcecc5fe75520a08fef72f6b476e (diff) |
Merge "Performance Improvement: Tune Resttemplate"
-rw-r--r-- | cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java index a41815554f..f250ddb73a 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java @@ -20,6 +20,7 @@ package org.onap.cps.ncmp.api.impl.config; +import java.time.Duration; import java.util.Arrays; import lombok.AccessLevel; import lombok.Getter; @@ -39,6 +40,9 @@ import org.springframework.web.client.RestTemplate; @RequiredArgsConstructor(access = AccessLevel.PROTECTED) public class NcmpConfiguration { + private static final Duration CONNECTION_TIMEOUT_MILLISECONDS = Duration.ofMillis(180000); + private static final Duration READ_TIMEOUT_MILLISECONDS = Duration.ofMillis(180000); + @Getter @Component public static class DmiProperties { @@ -59,7 +63,8 @@ public class NcmpConfiguration { @Bean @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public static RestTemplate restTemplate(final RestTemplateBuilder restTemplateBuilder) { - final RestTemplate restTemplate = restTemplateBuilder.build(); + final RestTemplate restTemplate = restTemplateBuilder.setConnectTimeout(CONNECTION_TIMEOUT_MILLISECONDS) + .setReadTimeout(READ_TIMEOUT_MILLISECONDS).build(); setRestTemplateMessageConverters(restTemplate); return restTemplate; } |