Merge MAPREDUCE-4031 from trunk. Prevent a Node Manager hang during shutdown. (Contributed by Devaraj K)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1353040 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
13bbb35577
commit
461ef73bf2
|
@ -30,7 +30,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
|
||||
/**
|
||||
* The <code>ShutdownHookManager</code> enables running shutdownHook
|
||||
* in a determistic order, higher priority first.
|
||||
* in a deterministic order, higher priority first.
|
||||
* <p/>
|
||||
* The JVM runs ShutdownHooks in a non-deterministic order or in parallel.
|
||||
* This class registers a single JVM shutdownHook and run all the
|
||||
|
@ -169,7 +169,7 @@ public class ShutdownHookManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Indicates if a shutdownHook is registered or nt.
|
||||
* Indicates if a shutdownHook is registered or not.
|
||||
*
|
||||
* @param shutdownHook shutdownHook to check if registered.
|
||||
* @return TRUE/FALSE depending if the shutdownHook is is registered.
|
||||
|
@ -177,5 +177,14 @@ public class ShutdownHookManager {
|
|||
public boolean hasShutdownHook(Runnable shutdownHook) {
|
||||
return hooks.contains(new HookEntry(shutdownHook, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if shutdown is in progress or not.
|
||||
*
|
||||
* @return TRUE if the shutdown is in progress, otherwise FALSE.
|
||||
*/
|
||||
public boolean isShutdownInProgress() {
|
||||
return shutdownInProgress.get();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,6 +57,9 @@ Release 2.0.1-alpha - UNRELEASED
|
|||
MAPREDUCE-4306. Fix distributed shell to work with users other than the one
|
||||
running the daemons. (Ahmed Radwan via sseth)
|
||||
|
||||
MAPREDUCE-4031. Prevent a Node Manager hang during shutdown.
|
||||
(Devaraj K via sseth)
|
||||
|
||||
Release 2.0.0-alpha - 05-23-2012
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.util.ShutdownHookManager;
|
||||
import org.apache.hadoop.yarn.YarnException;
|
||||
import org.apache.hadoop.yarn.service.AbstractService;
|
||||
|
||||
|
@ -127,7 +128,8 @@ public class AsyncDispatcher extends AbstractService implements Dispatcher {
|
|||
catch (Throwable t) {
|
||||
//TODO Maybe log the state of the queue
|
||||
LOG.fatal("Error in dispatcher thread", t);
|
||||
if (exitOnDispatchException) {
|
||||
if (exitOnDispatchException
|
||||
&& (ShutdownHookManager.get().isShutdownInProgress()) == false) {
|
||||
LOG.info("Exiting, bbye..");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue