Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-986 -- Return invalid error codes in case of an exception or an error while waiting for external process

Shalin Shekhar Mangar23ab5e1869b5
diff --git a/src/java/org/apache/solr/core/RunExecutableListener.java b/src/java/org/apache/solr/core/RunExecutableListener.java
index 2e5404d6bfb..01ac6340d5e 100644
--- a/src/java/org/apache/solr/core/RunExecutableListener.java
+++ b/src/java/org/apache/solr/core/RunExecutableListener.java
@@ -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;
+
}