Repository: thrift Updated Branches: refs/heads/master 804504b79 -> b121a586b
THRIFT-3345 Clients blocked indefinitely when a java.lang.Error is thrown Client: Java Author: huahang <[email protected]> This closes #618 Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/b121a586 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/b121a586 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/b121a586 Branch: refs/heads/master Commit: b121a586b20c801bb52aa423b2d0edddf5d3ce9e Parents: 804504b Author: Jens Geyer <[email protected]> Authored: Wed Sep 23 23:04:17 2015 +0200 Committer: Jens Geyer <[email protected]> Committed: Wed Sep 23 23:05:26 2015 +0200 ---------------------------------------------------------------------- .../apache/thrift/server/TThreadPoolServer.java | 29 +++++++++----------- 1 file changed, 13 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/b121a586/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java ---------------------------------------------------------------------- diff --git a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java index a963bc9..0529d72 100755 --- a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java +++ b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java @@ -295,22 +295,19 @@ public class TThreadPoolServer extends TServer { LOGGER.error("Thrift error occurred during processing of message.", tx); } catch (Exception x) { LOGGER.error("Error occurred during processing of message.", x); - } - - if (eventHandler != null) { - eventHandler.deleteContext(connectionContext, inputProtocol, outputProtocol); - } - - if (inputTransport != null) { - inputTransport.close(); - } - - if (outputTransport != null) { - outputTransport.close(); - } - - if (client_.isOpen()) { - client_.close(); + } finally { + if (eventHandler != null) { + eventHandler.deleteContext(connectionContext, inputProtocol, outputProtocol); + } + if (inputTransport != null) { + inputTransport.close(); + } + if (outputTransport != null) { + outputTransport.close(); + } + if (client_.isOpen()) { + client_.close(); + } } } }
