Updated Branches: refs/heads/flume-1.4 dc613bc22 -> 4a8b3024c
FLUME-2025. ThriftSource throws NPE in stop() if start() failed because socket open failed or if thrift server instance creation threw. (Hari Shreedharan via Mike Percy) Project: http://git-wip-us.apache.org/repos/asf/flume/repo Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/4a8b3024 Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/4a8b3024 Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/4a8b3024 Branch: refs/heads/flume-1.4 Commit: 4a8b3024ce2230c7d4675ffd9d1bf27c365761e6 Parents: dc613bc Author: Mike Percy <[email protected]> Authored: Thu Jun 13 18:03:06 2013 -0700 Committer: Mike Percy <[email protected]> Committed: Thu Jun 13 18:03:36 2013 -0700 ---------------------------------------------------------------------- .../java/org/apache/flume/source/ThriftSource.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flume/blob/4a8b3024/flume-ng-core/src/main/java/org/apache/flume/source/ThriftSource.java ---------------------------------------------------------------------- diff --git a/flume-ng-core/src/main/java/org/apache/flume/source/ThriftSource.java b/flume-ng-core/src/main/java/org/apache/flume/source/ThriftSource.java index 5856e90..68a632a 100644 --- a/flume-ng-core/src/main/java/org/apache/flume/source/ThriftSource.java +++ b/flume-ng-core/src/main/java/org/apache/flume/source/ThriftSource.java @@ -153,14 +153,16 @@ public class ThriftSource extends AbstractSource implements Configurable, if(server != null && server.isServing()) { server.stop(); } - servingExecutor.shutdown(); - try { - if(!servingExecutor.awaitTermination(5, TimeUnit.SECONDS)) { - servingExecutor.shutdownNow(); + if (servingExecutor != null) { + servingExecutor.shutdown(); + try { + if (!servingExecutor.awaitTermination(5, TimeUnit.SECONDS)) { + servingExecutor.shutdownNow(); + } + } catch (InterruptedException e) { + throw new FlumeException("Interrupted while waiting for server to be " + + "shutdown."); } - } catch (InterruptedException e) { - throw new FlumeException("Interrupted while waiting for server to be " + - "shutdown."); } sourceCounter.stop(); super.stop();
