fix reindexing on application startup

This commit is contained in:
Benjamin Gamard 2018-03-31 13:24:25 +02:00
parent e72dab2a6e
commit b3349176d9
2 changed files with 12 additions and 11 deletions

View File

@ -64,9 +64,9 @@ public class AppContext {
private List<ExecutorService> asyncExecutorList;
/**
* Private constructor.
* Start the application context.
*/
private AppContext() {
private void startUp() {
resetEventBus();
// Start indexing handler
@ -74,7 +74,7 @@ public class AppContext {
try {
indexingHandler.startUp();
} catch (Exception e) {
log.error("Error starting the indexing handler, rebuilding the index", e);
log.error("Error starting the indexing handler, rebuilding the index: " + e.getMessage());
RebuildIndexAsyncEvent rebuildIndexAsyncEvent = new RebuildIndexAsyncEvent();
asyncEventBus.post(rebuildIndexAsyncEvent);
}
@ -138,6 +138,7 @@ public class AppContext {
public static AppContext getInstance() {
if (instance == null) {
instance = new AppContext();
instance.startUp();
}
return instance;
}

View File

@ -13,7 +13,7 @@ public class DialectUtil {
* @return Object not found
*/
public static boolean isObjectNotFound(String message) {
return EMF.isDriverH2() && message.contains("object not found") ||
return EMF.isDriverH2() && message.contains("not found") ||
EMF.isDriverPostgresql() && message.contains("does not exist");
}