[ http://issues.apache.org/jira/browse/HADOOP-488?page=comments#action_12431285 ] Owen O'Malley commented on HADOOP-488: --------------------------------------
It used to do this and the problem is that calling System.exit is very problematic for multi-threaded code. In particular, what was happening was the "main" procedure (and therefore thread) finished and the ToolBase called System.exit. But there were still threads that had work left to do and they were killed mid-action. System.exit is very dangerous in multi-threaded code and calling it in a framework class is usually a bad diea. > Change ToolBase.doMain() to return a status code > ------------------------------------------------ > > Key: HADOOP-488 > URL: http://issues.apache.org/jira/browse/HADOOP-488 > Project: Hadoop > Issue Type: Improvement > Affects Versions: 0.6.0 > Reporter: Andrzej Bialecki > Fix For: 0.6.0 > > > I propose to change the signature of ToolBase.doMain from this: > public final void doMain(Configuration conf, String[] args) throws > Exception; > to this: > public final int doMain(Configuration conf, String[] args) throws > Exception; > and then change main() methods of all classes that use ToolBase.doMain to > call System.exit(code), where "code" is this return value from doMain(). All > command-line tools, which still call main() methods of other tools, should be > converted to use doMain() and return exit codes properly. > The main reason for this change is that returning varying exit codes is > required for proper operation of shell scripts, especially differing between > code == 0 (normal exit) and code != 0 (error exit). > Additionally, current implementation of doMain() already gets the return > code, it just silently discards it (ToolBase.java:184). -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira