Source:
public static void main(String[] args) throws Throwable { StdOutErrLog.tieSystemOutAndErrToLog(); logger.debug("PID: " + System.getenv().get("JVM_PID")); logger.info("Child starting with classpath: {}", System.getProperty("java.class.path")); String appPath = System.getProperty(PROP_APP_PATH); if (appPath == null) { logger.error("{} not set in container environment.", PROP_APP_PATH); System.exit(1); } int exitStatus = 1; RecoverableRpcProxy rpcProxy = new RecoverableRpcProxy(appPath, new Configuration()); final StreamingContainerUmbilicalProtocol umbilical = rpcProxy.getProxy(); final String childId = System.getProperty(StreamingApplication.DT_PREFIX + "cid"); try { StreamingContainerContext ctx = umbilical.getInitContext(childId); StreamingContainer stramChild = new StreamingContainer(childId, umbilical); logger.debug("Container Context = {}", ctx); stramChild.setup(ctx); try { stramChild.heartbeatLoop(); exitStatus = 0; } finally { stramChild.teardown(); } } catch (Error error) { LogFileInformation logFileInfo = LoggerUtil.getLogFileInformation(); logger.error("Fatal error in container!", error); String msg = ExceptionUtils.getStackTrace(error); umbilical.reportError(childId, null, "FATAL: " + msg, logFileInfo); } catch (Exception exception) { LogFileInformation logFileInfo = LoggerUtil.getLogFileInformation(); logger.error("Fatal exception in container!", exception); String msg = ExceptionUtils.getStackTrace(exception); umbilical.reportError(childId, null, msg, logFileInfo); } finally { rpcProxy.close(); DefaultMetricsSystem.shutdown(); logger.info("Exit status for container: {}", exitStatus); LogManager.shutdown(); } if (exitStatus != 0) { System.exit(exitStatus); } }

Target:
public static void main(String[] args) throws Throwable { StdOutErrLog.tieSystemOutAndErrToLog(); logger.debug("PID: " + System.getenv().get("JVM_PID")); logger.info("Child starting with classpath: {}", System.getProperty("java.class.path")); String appPath = System.getProperty(PROP_APP_PATH); if (appPath == null) { logger.error("{} not set in container environment.", PROP_APP_PATH); System.exit(1); } int exitStatus = 1; RecoverableRpcProxy rpcProxy = null; StreamingContainerUmbilicalProtocol umbilical = null; final String childId = System.getProperty(StreamingApplication.DT_PREFIX + "cid"); try { rpcProxy = new RecoverableRpcProxy(appPath, new Configuration()); umbilical = rpcProxy.getProxy(); StreamingContainerContext ctx = umbilical.getInitContext(childId); StreamingContainer stramChild = new StreamingContainer(childId, umbilical); logger.debug("Container Context = {}", ctx); stramChild.setup(ctx); try { stramChild.heartbeatLoop(); exitStatus = 0; } finally { stramChild.teardown(); } } catch (Error | Exception e) { LogFileInformation logFileInfo = LoggerUtil.getLogFileInformation(); logger.error("Fatal in container!", (e instanceof Error) ? "Error" : "Exception", e); try { umbilical.reportError(childId, null, ExceptionUtils.getStackTrace(e), logFileInfo); } catch (Exception ex) { logger.debug("Fail to log", ex); } } finally { if (rpcProxy != null) { rpcProxy.close(); } DefaultMetricsSystem.shutdown(); logger.info("Exit status for container: {}", exitStatus); LogManager.shutdown(); if (exitStatus != 0) { System.exit(exitStatus); } } }