You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flume.apache.org by es...@apache.org on 2011/08/12 02:47:37 UTC

svn commit: r1156894 - /incubator/flume/branches/flume-728/flume-ng-core/src/main/java/org/apache/flume/core/LogicalNode.java

Author: esammer
Date: Fri Aug 12 00:47:36 2011
New Revision: 1156894

URL: http://svn.apache.org/viewvc?rev=1156894&view=rev
Log:
- If LogicalNode receives an interrupt while starting, attempt to stop. - If we receive an interrupt while stopping, fail miserably.

Modified:
    incubator/flume/branches/flume-728/flume-ng-core/src/main/java/org/apache/flume/core/LogicalNode.java

Modified: incubator/flume/branches/flume-728/flume-ng-core/src/main/java/org/apache/flume/core/LogicalNode.java
URL: http://svn.apache.org/viewvc/incubator/flume/branches/flume-728/flume-ng-core/src/main/java/org/apache/flume/core/LogicalNode.java?rev=1156894&r1=1156893&r2=1156894&view=diff
==============================================================================
--- incubator/flume/branches/flume-728/flume-ng-core/src/main/java/org/apache/flume/core/LogicalNode.java (original)
+++ incubator/flume/branches/flume-728/flume-ng-core/src/main/java/org/apache/flume/core/LogicalNode.java Fri Aug 12 00:47:36 2011
@@ -1,6 +1,5 @@
 package org.apache.flume.core;
 
-import org.apache.flume.core.ChannelDriver.ChannelDriverThread;
 import org.apache.flume.lifecycle.LifecycleAware;
 import org.apache.flume.lifecycle.LifecycleException;
 import org.apache.flume.lifecycle.LifecycleState;
@@ -98,30 +97,7 @@ public class LogicalNode implements Life
             .error("Interrupted while waiting for driver to start. Shutting down.");
         lifecycleState = LifecycleState.ERROR;
 
-        driver.setShouldStop(true);
-
-        /*
-         * We refuse to return with outstanding resources so we go into a cycle
-         * where we interrupt the driver thread and block on it. If we're
-         * interrupted again while waiting for it, we warn, but we still refuse
-         * to give up on it. Sorry, caller; we don't know what the source or
-         * sink is doing so we have to give them time!
-         */
-        while (driver.isAlive()) {
-          logger.debug("Interrupting driver");
-
-          driver.interrupt();
-
-          logger.debug("Waiting for driver to stop");
-          try {
-            driver.join();
-          } catch (InterruptedException e1) {
-            logger
-                .warn(
-                    "Interrupted while waiting for driver to stop. This almost certainly means something awful is happening in the source or sink. Report this error. Interrupting it again!",
-                    e1);
-          }
-        }
+        stop(context);
 
         return;
       }
@@ -141,22 +117,12 @@ public class LogicalNode implements Life
     while (driver.isAlive()) {
       logger.debug("Waiting for driver to stop");
 
+      /* If we're interrupted during a stop, we just fail. */
       try {
         driver.join();
       } catch (InterruptedException e) {
-        logger
-            .error("Interrupted while waiting for driver to stop. Interrupting it.");
+        logger.error("Interrupted while waiting for driver thread to stop", e);
         lifecycleState = LifecycleState.ERROR;
-
-        /*
-         * We refuse to return with outstanding resources so we go into a cycle
-         * where we interrupt the driver thread and block on it. If we're
-         * interrupted again while waiting for it, we warn, but we still refuse
-         * to give up on it. Sorry, caller; we don't know what the source or
-         * sink is doing so we have to give them time!
-         */
-        logger.debug("Interrupting driver");
-        driver.interrupt();
       }
     }