Example usage for org.apache.hadoop.util ExitUtil terminateCalled

List of usage examples for org.apache.hadoop.util ExitUtil terminateCalled

Introduction

In this page you can find the example usage for org.apache.hadoop.util ExitUtil terminateCalled.

Prototype

public static boolean terminateCalled() 

Source Link

Usage

From source file:com.mellanox.r4h.MiniDFSCluster.java

License:Apache License

/**
 * Shutdown all the nodes in the cluster.
 *//*from  w  w  w. j a  v  a 2s  .  c o m*/
public void shutdown(boolean deleteDfsDir) {
    LOG.info("Shutting down the Mini HDFS Cluster");
    if (checkExitOnShutdown) {
        if (ExitUtil.terminateCalled()) {
            LOG.fatal("Test resulted in an unexpected exit", ExitUtil.getFirstExitException());
            ExitUtil.resetFirstExitException();
            throw new AssertionError("Test resulted in an unexpected exit");
        }
    }
    shutdownDataNodes();
    for (NameNodeInfo nnInfo : nameNodes) {
        if (nnInfo == null)
            continue;
        NameNode nameNode = nnInfo.nameNode;
        if (nameNode != null) {
            nameNode.stop();
            nameNode.join();
            nameNode = null;
        }
    }
    if (deleteDfsDir) {
        base_dir.delete();
    } else {
        base_dir.deleteOnExit();
    }
}