aboutsummaryrefslogtreecommitdiffstats
path: root/common/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/main/java/org')
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java2
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java18
-rw-r--r--common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java13
-rw-r--r--common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java6
4 files changed, 27 insertions, 12 deletions
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java
index a44dbd636f..e4989059a3 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java
@@ -44,7 +44,7 @@ public class NssmfAdapterNBIRequest implements Serializable {
private DeAllocateNssi deAllocateNssi;
- private String subnetCapabilityQuery;
+ private Object subnetCapabilityQuery;
private String responseId;
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
index 8ea0eb6587..e97aa704eb 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
@@ -48,23 +48,23 @@ public class SliceTaskParamsAdapter implements Serializable {
private String nstName;
- private Map<String, Object> serviceProfile;
+ private Map<String, Object> serviceProfile = new HashMap<>();
private String suggestNsiId;
private String suggestNsiName;
- private TemplateInfo NSTInfo;
+ private TemplateInfo NSTInfo = new TemplateInfo();
- private SliceTaskInfo<TnSliceProfile> tnBHSliceTaskInfo;
+ private SliceTaskInfo<TnSliceProfile> tnBHSliceTaskInfo = new SliceTaskInfo<>();
- private SliceTaskInfo<TnSliceProfile> tnMHSliceTaskInfo;
+ private SliceTaskInfo<TnSliceProfile> tnMHSliceTaskInfo = new SliceTaskInfo<>();
- private SliceTaskInfo<TnSliceProfile> tnFHSliceTaskInfo;
+ private SliceTaskInfo<TnSliceProfile> tnFHSliceTaskInfo = new SliceTaskInfo<>();
- private SliceTaskInfo<CnSliceProfile> cnSliceTaskInfo;
+ private SliceTaskInfo<CnSliceProfile> cnSliceTaskInfo = new SliceTaskInfo<>();
- private SliceTaskInfo<AnSliceProfile> anSliceTaskInfo;
+ private SliceTaskInfo<AnSliceProfile> anSliceTaskInfo = new SliceTaskInfo<>();
@SuppressWarnings("unchecked")
public void convertFromJson(String jsonString) throws IOException {
@@ -226,6 +226,10 @@ public class SliceTaskParamsAdapter implements Serializable {
*/
private <T> Map<String, Object> bean2Map(T t) {
Map<String, Object> resMap = new HashMap<>();
+ if (t == null) {
+ return resMap;
+ }
+
try {
Field[] fields = t.getClass().getDeclaredFields();
for (Field field : fields) {
diff --git a/common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java b/common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java
index 6c2c76e87c..b17b1fe0fe 100644
--- a/common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java
+++ b/common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java
@@ -38,15 +38,18 @@ public class HttpClientConnectionConfiguration {
@Value(value = "${rest.http.client.configuration.socketTimeOutInSec:180}")
private int socketTimeOutInSeconds;
- @Value(value = "${rest.http.client.configuration.socketTimeOutInSec:600}")
+ @Value(value = "${rest.http.client.configuration.timeToLiveInSeconds:600}")
private int timeToLiveInSeconds;
- @Value(value = "${rest.http.client.configuration.maxConnections:10}")
+ @Value(value = "${rest.http.client.configuration.maxConnections:100}")
private int maxConnections;
- @Value(value = "${rest.http.client.configuration.maxConnectionsPerRoute:2}")
+ @Value(value = "${rest.http.client.configuration.maxConnectionsPerRoute:20}")
private int maxConnectionsPerRoute;
+ @Value(value = "${rest.http.client.configuration.evictIdleConnectionsTimeInSec:5}")
+ private int evictIdleConnectionsTimeInSec;
+
/**
* @return the socket connection time out in milliseconds
*/
@@ -82,4 +85,8 @@ public class HttpClientConnectionConfiguration {
return (int) TimeUnit.SECONDS.toMinutes(timeToLiveInSeconds);
}
+ public long getEvictIdleConnectionsTimeInSec() {
+ return evictIdleConnectionsTimeInSec;
+ }
+
}
diff --git a/common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java b/common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java
index 882ed95cfc..aef2ed165e 100644
--- a/common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java
+++ b/common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java
@@ -22,6 +22,7 @@ package org.onap.so.configuration.rest;
import java.util.concurrent.TimeUnit;
import org.apache.http.client.config.RequestConfig;
+import org.apache.http.impl.NoConnectionReuseStrategy;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
@@ -55,7 +56,10 @@ public class HttpComponentsClientConfiguration {
return HttpClientBuilder.create().setConnectionManager(poolingHttpClientConnectionManager())
.setMaxConnPerRoute(clientConnectionConfiguration.getMaxConnectionsPerRoute())
.setMaxConnTotal(clientConnectionConfiguration.getMaxConnections())
- .setDefaultRequestConfig(requestConfig()).build();
+ .setDefaultRequestConfig(requestConfig()).setConnectionReuseStrategy(NoConnectionReuseStrategy.INSTANCE)
+ .evictExpiredConnections().evictIdleConnections(
+ clientConnectionConfiguration.getEvictIdleConnectionsTimeInSec(), TimeUnit.SECONDS)
+ .build();
}
@Bean