Author: shalin
Date: Thu Feb  5 19:38:52 2009
New Revision: 741257

URL: http://svn.apache.org/viewvc?rev=741257&view=rev
Log:
SOLR-986 -- Return invalid error codes in case of an exception or an error 
while waiting for external process

Modified:
    lucene/solr/trunk/src/java/org/apache/solr/core/RunExecutableListener.java

Modified: 
lucene/solr/trunk/src/java/org/apache/solr/core/RunExecutableListener.java
URL: 
http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/RunExecutableListener.java?rev=741257&r1=741256&r2=741257&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/core/RunExecutableListener.java 
(original)
+++ lucene/solr/trunk/src/java/org/apache/solr/core/RunExecutableListener.java 
Thu Feb  5 19:38:52 2009
@@ -61,6 +61,14 @@
     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 @@
           ret = proc.waitFor();
         } catch (InterruptedException e) {
           SolrException.log(log,e);
+          ret = INVALID_PROCESS_RETURN_CODE;
         }
       }
 
@@ -86,6 +95,7 @@
     } 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 @@
     exec("newSearcher");
   }
 
+  /** Non-zero value for an invalid return code **/
+  private static int INVALID_PROCESS_RETURN_CODE = -1;
+
 }


Reply via email to