[CORE] close all resources even if #beforeIndexShardClosed throws an exception
Conflicts: src/main/java/org/elasticsearch/index/IndexService.java
This commit is contained in:
parent
16f19bf7bd
commit
3e2f4b86e4
|
@ -375,8 +375,11 @@ public class IndexService extends AbstractIndexComponent implements IndexCompone
|
|||
|
||||
private void closeShardInjector(String reason, ShardId sId, Injector shardInjector, IndexShard indexShard) {
|
||||
final int shardId = sId.id();
|
||||
try {
|
||||
try {
|
||||
indicesLifecycle.beforeIndexShardClosed(sId, indexShard, indexSettings);
|
||||
} finally {
|
||||
// close everything else even if the beforeIndexShardClosed threw an exception
|
||||
for (Class<? extends Closeable> closeable : pluginsService.shardServices()) {
|
||||
try {
|
||||
shardInjector.getInstance(closeable).close();
|
||||
|
@ -406,6 +409,7 @@ public class IndexService extends AbstractIndexComponent implements IndexCompone
|
|||
|
||||
// call this before we close the store, so we can release resources for it
|
||||
indicesLifecycle.afterIndexShardClosed(sId, indexShard, indexSettings);
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
shardInjector.getInstance(Store.class).close();
|
||||
|
|
Loading…
Reference in New Issue