Hyunsun Moon

Set REST API request timeout

Change-Id: I448399e75fffe050d2f638cca5f14390125c4910
......@@ -4,6 +4,7 @@ COMPILE_DEPS = [
'//lib:openstack4j-core',
'//lib:openstack4j-http-connector',
'//lib:openstack4j-httpclient',
'//lib:jersey-client',
]
osgi_jar_with_tests (
......
......@@ -49,6 +49,10 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
</dependency>
<dependency>
<groupId>org.pacesys</groupId>
<artifactId>openstack4j-core</artifactId>
<version>2.11</version>
......
......@@ -15,6 +15,7 @@
*/
package org.onosproject.xosclient.impl;
import org.glassfish.jersey.client.ClientProperties;
import org.onosproject.xosclient.api.XosAccess;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -42,6 +43,8 @@ public class XosApi {
protected final XosAccess access;
protected final Client client;
private static final int DEFAULT_TIMEOUT_MS = 2000;
/**
* Default constructor.
*
......@@ -52,6 +55,9 @@ public class XosApi {
this.baseUrl = baseUrl;
this.access = xosAccess;
this.client = ClientBuilder.newClient();
client.property(ClientProperties.CONNECT_TIMEOUT, DEFAULT_TIMEOUT_MS);
client.property(ClientProperties.READ_TIMEOUT, DEFAULT_TIMEOUT_MS);
}
/**
......