Michael Blow has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1276

Change subject: ASTERIXDB-1687 - Configure Timeout On HTTP Connection
......................................................................

ASTERIXDB-1687 - Configure Timeout On HTTP Connection

Fixes ASTERIXDB-1687 - asterixhelper get_cluster_state can hang forever,
by configuring a timeout on connect and read for HTTP calls, in the
event the CC is in a bad state and cannot answer requests

Change-Id: Ice9606acaec8f27b56d1d8ed947cc1588074ff2f
---
M 
asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/76/1276/1

diff --git 
a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
 
b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
index 031a721..7e1e318 100644
--- 
a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
+++ 
b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
@@ -23,6 +23,7 @@
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.asterix.clienthelper.Args;
 
@@ -64,6 +65,8 @@
     protected HttpURLConnection openConnection(String path, Method method) 
throws IOException {
         URL url = new URL("http://"; + hostPort + "/" + path);
         HttpURLConnection conn = (HttpURLConnection)url.openConnection();
+        conn.setConnectTimeout((int) 
TimeUnit.SECONDS.toMillis(args.getTimeoutSecs()));
+        conn.setReadTimeout((int) 
TimeUnit.SECONDS.toMillis(args.getTimeoutSecs()));
         conn.setRequestMethod(method.name());
         return conn;
     }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1276
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice9606acaec8f27b56d1d8ed947cc1588074ff2f
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mb...@apache.org>

Reply via email to