HDFS-8896. DataNode object isn't GCed when shutdown, because it has GC root in ShutdownHookManager. Contributed by Walter Su.

This commit is contained in:
Jing Zhao 2015-08-26 16:26:18 -07:00
parent c992bcf9c1
commit f44b599003
3 changed files with 11 additions and 0 deletions

View File

@ -187,4 +187,10 @@ public class ShutdownHookManager {
return shutdownInProgress.get(); return shutdownInProgress.get();
} }
/**
* clear all registered shutdownHooks.
*/
public void clearShutdownHooks() {
hooks.clear();
}
} }

View File

@ -841,6 +841,9 @@ Release 2.8.0 - UNRELEASED
HDFS-8951. Move the shortcircuit package to hdfs-client. HDFS-8951. Move the shortcircuit package to hdfs-client.
(Mingliang Liu via wheat9) (Mingliang Liu via wheat9)
HDFS-8896. DataNode object isn't GCed when shutdown, because it has GC
root in ShutdownHookManager. (Walter Su via jing9)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -119,6 +119,7 @@ import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.authorize.ProxyUsers; import org.apache.hadoop.security.authorize.ProxyUsers;
import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.ExitUtil; import org.apache.hadoop.util.ExitUtil;
import org.apache.hadoop.util.ShutdownHookManager;
import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.ToolRunner; import org.apache.hadoop.util.ToolRunner;
@ -1867,6 +1868,7 @@ public class MiniDFSCluster {
nameNode = null; nameNode = null;
} }
} }
ShutdownHookManager.get().clearShutdownHooks();
if (base_dir != null) { if (base_dir != null) {
if (deleteDfsDir) { if (deleteDfsDir) {
base_dir.delete(); base_dir.delete();