Java Code Examples for org.apache.hadoop.util.StringUtils#startupShutdownMessage()

The following examples show how to use org.apache.hadoop.util.StringUtils#startupShutdownMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JobHistoryServer.java    From XLearning with Apache License 2.0 6 votes vote down vote up
static JobHistoryServer launchJobHistoryServer(String[] args) {
  Thread.
      setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler());
  StringUtils.startupShutdownMessage(JobHistoryServer.class, args, LOG);
  JobHistoryServer jobHistoryServer = null;
  try {
    jobHistoryServer = new JobHistoryServer();
    ShutdownHookManager.get().addShutdownHook(
        new CompositeServiceShutdownHook(jobHistoryServer),
        SHUTDOWN_HOOK_PRIORITY);
    YarnConfiguration conf = new YarnConfiguration(new JobConf());
    new GenericOptionsParser(conf, args);
    jobHistoryServer.init(conf);
    jobHistoryServer.start();
  } catch (Throwable t) {
    LOG.fatal("Error starting JobHistoryServer", t);
    ExitUtil.terminate(-1, "Error starting JobHistoryServer");
  }
  return jobHistoryServer;
}
 
Example 2
Source File: JobHistoryServer.java    From big-c with Apache License 2.0 6 votes vote down vote up
static JobHistoryServer launchJobHistoryServer(String[] args) {
  Thread.
      setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler());
  StringUtils.startupShutdownMessage(JobHistoryServer.class, args, LOG);
  JobHistoryServer jobHistoryServer = null;
  try {
    jobHistoryServer = new JobHistoryServer();
    ShutdownHookManager.get().addShutdownHook(
        new CompositeServiceShutdownHook(jobHistoryServer),
        SHUTDOWN_HOOK_PRIORITY);
    YarnConfiguration conf = new YarnConfiguration(new JobConf());
    new GenericOptionsParser(conf, args);
    jobHistoryServer.init(conf);
    jobHistoryServer.start();
  } catch (Throwable t) {
    LOG.fatal("Error starting JobHistoryServer", t);
    ExitUtil.terminate(-1, "Error starting JobHistoryServer");
  }
  return jobHistoryServer;
}
 
Example 3
Source File: ResourceManager.java    From big-c with Apache License 2.0 6 votes vote down vote up
public static void main(String argv[]) {

   Thread.setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler());
   StringUtils.startupShutdownMessage(ResourceManager.class, argv, LOG);
   try {

     Configuration conf = new YarnConfiguration();
     GenericOptionsParser hParser = new GenericOptionsParser(conf, argv);
     argv = hParser.getRemainingArgs();
     // If -format-state-store, then delete RMStateStore; else startup normally
     if (argv.length == 1 && argv[0].equals("-format-state-store")) {
       deleteRMStateStore(conf);
     } else {
       ResourceManager resourceManager = new ResourceManager();
       ShutdownHookManager.get().addShutdownHook(
         new CompositeServiceShutdownHook(resourceManager),
         SHUTDOWN_HOOK_PRIORITY);
       resourceManager.init(conf);
       resourceManager.start();
     }
   } catch (Throwable t) {
     LOG.fatal("Error starting ResourceManager", t);
     System.exit(-1);
   }
   
 }
 
Example 4
Source File: DataNode.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public static void secureMain(String args[], SecureResources resources) {
  int errorCode = 0;
  try {
    StringUtils.startupShutdownMessage(DataNode.class, args, LOG);
    DataNode datanode = createDataNode(args, null, resources);
    if (datanode != null) {
      datanode.join();
    } else {
      errorCode = 1;
    }
  } catch (Throwable e) {
    LOG.fatal("Exception in secureMain", e);
    terminate(1, e);
  } finally {
    // We need to terminate the process here because either shutdown was called
    // or some disk related conditions like volumes tolerated or volumes required
    // condition was not met. Also, In secure mode, control will go to Jsvc
    // and Datanode process hangs if it does not exit.
    LOG.warn("Exiting Datanode");
    terminate(errorCode);
  }
}
 
Example 5
Source File: NameNode.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 */
public static void main(String argv[]) throws Exception {
  if (DFSUtil.parseHelpArgument(argv, NameNode.USAGE, System.out, true)) {
    System.exit(0);
  }

  try {
    StringUtils.startupShutdownMessage(NameNode.class, argv, LOG);
    NameNode namenode = createNameNode(argv, null);
    if (namenode != null) {
      namenode.join();
    }
  } catch (Throwable e) {
    LOG.error("Failed to start namenode.", e);
    terminate(1, e);
  }
}
 
Example 6
Source File: DataNode.java    From big-c with Apache License 2.0 6 votes vote down vote up
public static void secureMain(String args[], SecureResources resources) {
  int errorCode = 0;
  try {
    StringUtils.startupShutdownMessage(DataNode.class, args, LOG);
    DataNode datanode = createDataNode(args, null, resources);
    if (datanode != null) {
      datanode.join();
    } else {
      errorCode = 1;
    }
  } catch (Throwable e) {
    LOG.fatal("Exception in secureMain", e);
    terminate(1, e);
  } finally {
    // We need to terminate the process here because either shutdown was called
    // or some disk related conditions like volumes tolerated or volumes required
    // condition was not met. Also, In secure mode, control will go to Jsvc
    // and Datanode process hangs if it does not exit.
    LOG.warn("Exiting Datanode");
    terminate(errorCode);
  }
}
 
Example 7
Source File: NameNode.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 */
public static void main(String argv[]) throws Exception {
  if (DFSUtil.parseHelpArgument(argv, NameNode.USAGE, System.out, true)) {
    System.exit(0);
  }

  try {
    StringUtils.startupShutdownMessage(NameNode.class, argv, LOG);
    NameNode namenode = createNameNode(argv, null);
    if (namenode != null) {
      namenode.join();
    }
  } catch (Throwable e) {
    LOG.error("Failed to start namenode.", e);
    terminate(1, e);
  }
}
 
Example 8
Source File: ApplicationHistoryServer.java    From hadoop with Apache License 2.0 6 votes vote down vote up
static ApplicationHistoryServer launchAppHistoryServer(String[] args) {
  Thread
    .setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler());
  StringUtils.startupShutdownMessage(ApplicationHistoryServer.class, args,
    LOG);
  ApplicationHistoryServer appHistoryServer = null;
  try {
    appHistoryServer = new ApplicationHistoryServer();
    ShutdownHookManager.get().addShutdownHook(
      new CompositeServiceShutdownHook(appHistoryServer),
      SHUTDOWN_HOOK_PRIORITY);
    YarnConfiguration conf = new YarnConfiguration();
    new GenericOptionsParser(conf, args);
    appHistoryServer.init(conf);
    appHistoryServer.start();
  } catch (Throwable t) {
    LOG.fatal("Error starting ApplicationHistoryServer", t);
    ExitUtil.terminate(-1, "Error starting ApplicationHistoryServer");
  }
  return appHistoryServer;
}
 
Example 9
Source File: AMSApplicationServer.java    From ambari-metrics with Apache License 2.0 6 votes vote down vote up
static AMSApplicationServer launchAMSApplicationServer(String[] args) {
  Thread.setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler());
  StringUtils.startupShutdownMessage(AMSApplicationServer.class, args, LOG);
  AMSApplicationServer amsApplicationServer = null;
  try {
    amsApplicationServer = new AMSApplicationServer();
    ShutdownHookManager.get().addShutdownHook(
      new CompositeServiceShutdownHook(amsApplicationServer),
      SHUTDOWN_HOOK_PRIORITY);
    YarnConfiguration conf = new YarnConfiguration();
    amsApplicationServer.init(conf);
    amsApplicationServer.start();
  } catch (Throwable t) {
    LOG.fatal("Error starting AMSApplicationServer", t);
    ExitUtil.terminate(-1, "Error starting AMSApplicationServer");
  }
  return amsApplicationServer;
}
 
Example 10
Source File: TajoWorker.java    From incubator-tajo with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
  StringUtils.startupShutdownMessage(TajoWorker.class, args, LOG);

  TajoConf tajoConf = new TajoConf();
  tajoConf.addResource(new Path(TajoConstants.SYSTEM_CONF_FILENAME));

  try {
    TajoWorker tajoWorker = new TajoWorker();
    tajoWorker.startWorker(tajoConf, args);
  } catch (Throwable t) {
    LOG.fatal("Error starting TajoWorker", t);
    System.exit(-1);
  }
}
 
Example 11
Source File: NodeManager.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws IOException {
  Thread.setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler());
  StringUtils.startupShutdownMessage(NodeManager.class, args, LOG);
  NodeManager nodeManager = new NodeManager();
  Configuration conf = new YarnConfiguration();
  new GenericOptionsParser(conf, args);
  nodeManager.initAndStartNodeManager(conf, false);
}
 
Example 12
Source File: Nfs3.java    From big-c with Apache License 2.0 5 votes vote down vote up
static void startService(String[] args,
    DatagramSocket registrationSocket) throws IOException {
  StringUtils.startupShutdownMessage(Nfs3.class, args, LOG);
  NfsConfiguration conf = new NfsConfiguration();
  boolean allowInsecurePorts = conf.getBoolean(
      NfsConfigKeys.DFS_NFS_PORT_MONITORING_DISABLED_KEY,
      NfsConfigKeys.DFS_NFS_PORT_MONITORING_DISABLED_DEFAULT);
  final Nfs3 nfsServer = new Nfs3(conf, registrationSocket,
      allowInsecurePorts);
  nfsServer.startServiceInternal(true);
}
 
Example 13
Source File: SecondaryNameNode.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * main() has some simple utility methods.
 * @param argv Command line parameters.
 * @exception Exception if the filesystem does not exist.
 */
public static void main(String[] argv) throws Exception {
  CommandLineOpts opts = SecondaryNameNode.parseArgs(argv);
  if (opts == null) {
    LOG.fatal("Failed to parse options");
    terminate(1);
  } else if (opts.shouldPrintHelp()) {
    opts.usage();
    System.exit(0);
  }
  
  StringUtils.startupShutdownMessage(SecondaryNameNode.class, argv, LOG);
  Configuration tconf = new HdfsConfiguration();
  SecondaryNameNode secondary = null;
  try {
    secondary = new SecondaryNameNode(tconf, opts);
  } catch (IOException ioe) {
    LOG.fatal("Failed to start secondary namenode", ioe);
    terminate(1);
  }

  if (opts != null && opts.getCommand() != null) {
    int ret = secondary.processStartupCommand(opts);
    terminate(ret);
  }

  if (secondary != null) {
    secondary.startCheckpointThread();
    secondary.join();
  }
}
 
Example 14
Source File: SecondaryNameNode.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
/**
 * main() has some simple utility methods.
 * @param argv Command line parameters.
 * @exception Exception if the filesystem does not exist.
 */
public static void main(String[] argv) throws Exception {
  StringUtils.startupShutdownMessage(SecondaryNameNode.class, argv, LOG);
  Configuration tconf = new Configuration();
  if (argv.length >= 1) {
    SecondaryNameNode secondary = new SecondaryNameNode(tconf);
    int ret = secondary.processArgs(argv);
    System.exit(ret);
  }

  // Create a never ending deamon
  Daemon checkpointThread = new Daemon(new SecondaryNameNode(tconf)); 
  checkpointThread.start();
}
 
Example 15
Source File: Portmap.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
  StringUtils.startupShutdownMessage(Portmap.class, args, LOG);

  final int port = RpcProgram.RPCB_PORT;
  Portmap pm = new Portmap();
  try {
    pm.start(DEFAULT_IDLE_TIME_MILLISECONDS,
        new InetSocketAddress(port), new InetSocketAddress(port));
  } catch (Throwable e) {
    LOG.fatal("Failed to start the server. Cause:", e);
    pm.shutdown();
    System.exit(-1);
  }
}
 
Example 16
Source File: RaidNode.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public static void main(String argv[]) throws Exception {
	try {
		StringUtils.startupShutdownMessage(RaidNode.class, argv, LOG);
		RaidNode raid = createRaidNode(argv, null);
		if (raid != null) {
			raid.join();
		}
	} catch (Throwable e) {
		LOG.error(StringUtils.stringifyException(e));
		System.exit(-1);
	}
}
 
Example 17
Source File: HighTideNode.java    From RDFS with Apache License 2.0 5 votes vote down vote up
/**
 */
public static void main(String argv[]) throws Exception {
  try {
    StringUtils.startupShutdownMessage(HighTideNode.class, argv, LOG);
    HighTideNode hightidenode = createHighTideNode(argv, null);
    if (hightidenode != null) {
      hightidenode.join();
    }
  } catch (Throwable e) {
    LOG.error(StringUtils.stringifyException(e));
    System.exit(-1);
  }
}
 
Example 18
Source File: WebAppProxyServer.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
  Thread.setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler());
  StringUtils.startupShutdownMessage(WebAppProxyServer.class, args, LOG);
  try {
    YarnConfiguration configuration = new YarnConfiguration();
    new GenericOptionsParser(configuration, args);
    WebAppProxyServer proxyServer = startServer(configuration);
    proxyServer.proxy.join();
  } catch (Throwable t) {
    ExitUtil.terminate(-1, t);
  }
}
 
Example 19
Source File: CoronaTaskTracker.java    From RDFS with Apache License 2.0 5 votes vote down vote up
/**
 * Start the TaskTracker, point toward the indicated JobTracker
 */
public static void main(String argv[]) throws Exception {
  StringUtils.startupShutdownMessage(CoronaTaskTracker.class, argv, LOG);
  if (argv.length != 0) {
    System.out.println("usage: CoronaTaskTracker");
    System.exit(-1);
  }
  JobConf conf=new JobConf();
  // enable the server to track time spent waiting on locks
  ReflectionUtils.setContentionTracing
    (conf.getBoolean("tasktracker.contention.tracking", false));
  new CoronaTaskTracker(conf).run();
}
 
Example 20
Source File: JournalNode.java    From big-c with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
  StringUtils.startupShutdownMessage(JournalNode.class, args, LOG);
  System.exit(ToolRunner.run(new JournalNode(), args));
}