From: Bill Erickson Date: Mon, 19 Mar 2012 13:10:23 +0000 (-0400) Subject: java gateway : wrap all onFoo handlers in try X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=999eb6cbf143e8a836020a686a7e33363b3ac3e0;p=working%2FOpenSRF.git java gateway : wrap all onFoo handlers in try Signed-off-by: Bill Erickson --- diff --git a/src/java/org/opensrf/net/http/HttpConnection.java b/src/java/org/opensrf/net/http/HttpConnection.java index 588abb7..c40b9f9 100644 --- a/src/java/org/opensrf/net/http/HttpConnection.java +++ b/src/java/org/opensrf/net/http/HttpConnection.java @@ -37,7 +37,9 @@ public class HttpConnection { } /** - * Set the maximum number of actively communicating threads allowed + * Set the maximum number of actively communicating (async) threads allowed. + * + * This has no effect on synchronous communication. */ public void setMaxThreads(int max) { maxThreads = max; @@ -70,25 +72,22 @@ public class HttpConnection { Runnable r = new Runnable() { public void run() { Object response; - boolean failed = false; try { request.send(); while ((response = request.recv()) != null) request.handler.onResponse(request, response); + request.handler.onComplete(request); + } catch (Exception ex) { request.handler.onError(request, ex); - failed = true; } finally { // server communication has completed activeThreads--; } - if (!failed) - request.handler.onComplete(request); - if (activeThreads < maxThreads) { try { manageAsyncRequest(pendingThreadQueue.remove());