Catch exception in callback of exception

This commit is contained in:
Ivannikov Kirill 2015-09-02 23:56:37 +05:00
parent 0d2675e80b
commit 92a6968f2a
1 changed files with 15 additions and 3 deletions

View File

@ -131,7 +131,11 @@ public class ShardIndexingService extends AbstractIndexShardComponent {
public void postCreate(Engine.Create create, Throwable ex) {
for (IndexingOperationListener listener : listeners) {
listener.postCreate(create, ex);
try {
listener.postCreate(create, ex);
} catch (Throwable t) {
logger.warn("postCreate listener [{}] failed", t, listener);
}
}
}
@ -175,7 +179,11 @@ public class ShardIndexingService extends AbstractIndexShardComponent {
totalStats.indexCurrent.dec();
typeStats(index.type()).indexCurrent.dec();
for (IndexingOperationListener listener : listeners) {
listener.postIndex(index, ex);
try {
listener.postIndex(index, ex);
} catch (Throwable t) {
logger.warn("postIndex listener [{}] failed", t, listener);
}
}
}
@ -218,7 +226,11 @@ public class ShardIndexingService extends AbstractIndexShardComponent {
totalStats.deleteCurrent.dec();
typeStats(delete.type()).deleteCurrent.dec();
for (IndexingOperationListener listener : listeners) {
listener.postDelete(delete, ex);
try {
listener. postDelete(delete, ex);
} catch (Throwable t) {
logger.warn("postDelete listener [{}] failed", t, listener);
}
}
}