Handle exceptions during reindexing

If an exception is thrown from within the change indexer, the reindex
program shows a stack trace.  In the case of an error when using the
Solr index, it does not exit and continues running, while showing debug
messages "Got ping response for sessionid", but not doing anything
else.

Catch exceptions in the indexer and exit with a fatal error message.

Change-Id: Ief41eccc0d3fe9c5592782b51afa66c0c3150886
This commit is contained in:
David Pursehouse
2014-02-06 15:22:01 +09:00
parent da82877813
commit 6ab111e94f

View File

@@ -143,11 +143,15 @@ public class Reindex extends SiteProgram {
sysManager.start();
index = sysInjector.getInstance(IndexCollection.class).getSearchIndex();
index.markReady(false);
index.deleteAll();
int result = indexAll();
index.markReady(true);
int result = 0;
try {
index.markReady(false);
index.deleteAll();
result = indexAll();
index.markReady(true);
} catch (Exception e) {
throw die(e.getMessage());
}
sysManager.stop();
dbManager.stop();
return result;