From 92a6968f2ad944f3540e2193eb99c9d8222081d6 Mon Sep 17 00:00:00 2001 From: Ivannikov Kirill Date: Wed, 2 Sep 2015 23:56:37 +0500 Subject: [PATCH] Catch exception in callback of exception --- .../index/indexing/ShardIndexingService.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/index/indexing/ShardIndexingService.java b/core/src/main/java/org/elasticsearch/index/indexing/ShardIndexingService.java index bbdde45c770..7766a314413 100644 --- a/core/src/main/java/org/elasticsearch/index/indexing/ShardIndexingService.java +++ b/core/src/main/java/org/elasticsearch/index/indexing/ShardIndexingService.java @@ -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); + } } }