diff options
Diffstat (limited to 'java/src/Ice/ConnectionI.java')
-rw-r--r-- | java/src/Ice/ConnectionI.java | 78 |
1 files changed, 31 insertions, 47 deletions
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java index d9ba8889fa9..7dedaa5b00a 100644 --- a/java/src/Ice/ConnectionI.java +++ b/java/src/Ice/ConnectionI.java @@ -1416,6 +1416,28 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne setState(StateClosed, ex); } + public synchronized void + invokeException(LocalException ex, int invokeNum) + { + // + // Fatal exception while invoking a request. Since sendResponse/sendNoResponse isn't + // called in case of a fatal exception we decrement _dispatchCount here. + // + + setState(StateClosed, ex); + + if(invokeNum > 0) + { + assert(_dispatchCount > 0); + _dispatchCount -= invokeNum; + assert(_dispatchCount >= 0); + if(_dispatchCount == 0) + { + notifyAll(); + } + } + } + public String type() { @@ -2189,37 +2211,18 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne } catch(LocalException ex) { - synchronized(this) - { - setState(StateClosed, ex); - } + invokeException(ex, invokeNum); } catch(java.lang.AssertionError ex) // Upon assertion, we print the stack trace. { - synchronized(this) - { - UnknownException uex = new UnknownException(); - java.io.StringWriter sw = new java.io.StringWriter(); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - ex.printStackTrace(pw); - pw.flush(); - uex.unknown = sw.toString(); - _logger.error(uex.unknown); - setState(StateClosed, uex); - } - } - catch(java.lang.Exception ex) - { - synchronized(this) - { - UnknownException uex = new UnknownException(); - java.io.StringWriter sw = new java.io.StringWriter(); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - ex.printStackTrace(pw); - pw.flush(); - uex.unknown = sw.toString(); - setState(StateClosed, uex); - } + UnknownException uex = new UnknownException(); + java.io.StringWriter sw = new java.io.StringWriter(); + java.io.PrintWriter pw = new java.io.PrintWriter(sw); + ex.printStackTrace(pw); + pw.flush(); + uex.unknown = sw.toString(); + _logger.error(uex.unknown); + invokeException(uex, invokeNum); } finally { @@ -2228,25 +2231,6 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne reclaimIncoming(in); } } - - // - // If invoke() above raised an exception, and therefore - // neither sendResponse() nor sendNoResponse() has been - // called, then we must decrement _dispatchCount here. - // - if(invokeNum > 0) - { - synchronized(this) - { - assert(_dispatchCount > 0); - _dispatchCount -= invokeNum; - assert(_dispatchCount >= 0); - if(_dispatchCount == 0) - { - notifyAll(); - } - } - } } private void |