javaswift / joss

Java library for OpenStack Storage, aka Swift
http://javaswift.org
117 stars 108 forks source link

PoolingClientConnectionManager http client time out is set wrongly, which makes client is parking there when swift sever is busy even socketTimeout is set #123

Open l0f011l opened 7 years ago

l0f011l commented 7 years ago

this.httpClient = new DefaultHttpClient(connectionManager); if (socketTimeout != -1) { LOG.info("JOSS / Set socket timeout on HttpClient: "+socketTimeout); HttpParams params = this.httpClient.getParams(); HttpConnectionParams.setSoTimeout(params, socketTimeout); }

socketTimeout value should be set to be the value of "http.conn-manager.timeout", as PoolingClientConnectionManager use it instead of "SO_TIMEOUT = "http.socket.timeout";"

if (timeout > 0) { -- timeout = value of http.conn-manager.timeout, not “http.socket.timeout” deadline = new Date (System.currentTimeMillis() + tunit.toMillis(timeout)); }

try { if (this.cancelled) { throw new InterruptedException("Operation interrupted"); } boolean success = false; if (deadline != null) { success = this.condition.awaitUntil(deadline); } else { this.condition.await(); success = true; }