Author: andygumbrecht Date: Sun Jul 13 10:56:39 2014 New Revision: 1610164 URL: http://svn.apache.org/r1610164 Log: Be more forgiving on connect
Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/HttpConnectionFactory.java Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/HttpConnectionFactory.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/HttpConnectionFactory.java?rev=1610164&r1=1610163&r2=1610164&view=diff ============================================================================== --- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/HttpConnectionFactory.java (original) +++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/HttpConnectionFactory.java Sun Jul 13 10:56:39 2014 @@ -60,10 +60,15 @@ public class HttpConnectionFactory imple httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setDoOutput(true); + final int timeout; if (params.containsKey("connectTimeout")) { - httpURLConnection.setConnectTimeout(Integer.parseInt(params.get("connectTimeout"))); + timeout = Integer.parseInt(params.get("connectTimeout")); + }else{ + timeout = 1000; } + httpURLConnection.setConnectTimeout(timeout); + if (params.containsKey("readTimeout")) { httpURLConnection.setReadTimeout(Integer.parseInt(params.get("readTimeout"))); } @@ -78,7 +83,11 @@ public class HttpConnectionFactory imple } } - httpURLConnection.connect(); + try { + httpURLConnection.connect(); + } catch (final IOException e) { + httpURLConnection.connect(); + } } @Override