You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flume.apache.org by mp...@apache.org on 2013/06/14 03:03:43 UTC

git commit: FLUME-2025. ThriftSource throws NPE in stop() if start() failed because socket open failed or if thrift server instance creation threw.

Updated Branches:
  refs/heads/trunk 337e5fc37 -> 296fc9f92


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/296fc9f9
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/296fc9f9
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/296fc9f9

Branch: refs/heads/trunk
Commit: 296fc9f92b51bbe9c674cede560ab7be8a03e161
Parents: 337e5fc
Author: Mike Percy <mp...@apache.org>
Authored: Thu Jun 13 18:03:06 2013 -0700
Committer: Mike Percy <mp...@apache.org>
Committed: Thu Jun 13 18:03:06 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/296fc9f9/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();