mirror of https://github.com/apache/lucene.git
SOLR-986 -- Return invalid error codes in case of an exception or an error while waiting for external process
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@741257 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4d4c5e0e1f
commit
23ab5e1869
|
@ -61,6 +61,14 @@ class RunExecutableListener extends AbstractSolrEventListener {
|
|||
if ("false".equals(args.get("wait")) || Boolean.FALSE.equals(args.get("wait"))) wait=false;
|
||||
}
|
||||
|
||||
/**
|
||||
* External executable listener.
|
||||
*
|
||||
* @param callback Unused (As of solr 1.4-dev)
|
||||
* @return Error code indicating if the command has executed successfully. <br />
|
||||
* 0 , indicates normal termination.<br />
|
||||
* non-zero , otherwise.
|
||||
*/
|
||||
protected int exec(String callback) {
|
||||
int ret = 0;
|
||||
|
||||
|
@ -76,6 +84,7 @@ class RunExecutableListener extends AbstractSolrEventListener {
|
|||
ret = proc.waitFor();
|
||||
} catch (InterruptedException e) {
|
||||
SolrException.log(log,e);
|
||||
ret = INVALID_PROCESS_RETURN_CODE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,6 +95,7 @@ class RunExecutableListener extends AbstractSolrEventListener {
|
|||
} catch (IOException e) {
|
||||
// don't throw exception, just log it...
|
||||
SolrException.log(log,e);
|
||||
ret = INVALID_PROCESS_RETURN_CODE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -103,4 +113,7 @@ class RunExecutableListener extends AbstractSolrEventListener {
|
|||
exec("newSearcher");
|
||||
}
|
||||
|
||||
/** Non-zero value for an invalid return code **/
|
||||
private static int INVALID_PROCESS_RETURN_CODE = -1;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue