From 36ffd6d5826211aef8fb082ff775fbe0f5a5d5f9 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Fri, 5 Apr 2013 22:45:40 +0200 Subject: [PATCH] release searcher in finally block rather than relying on an exception that is thrown --- .../org/elasticsearch/index/engine/robin/RobinEngine.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java b/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java index e30339ce17a..0c9207acfe3 100644 --- a/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java +++ b/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java @@ -337,11 +337,11 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine { } } } catch (Exception e) { - searcher.release(); //TODO: A better exception goes here throw new EngineException(shardId(), "failed to load document", e); + } finally { + searcher.release(); } - searcher.release(); return GetResult.NOT_EXISTS; } finally { rwl.readLock().unlock();