elasticsearch/elasticsearch — pull request #5884 by s1monw (2014-04-19 15:17:58+00:00)
Title: Searcher might not be closed if store hande can't be obtained

Today we first get a reference to the IndexSearcher in #acquireSearcher
and then futher down we try to run Store#incRef() which might throw an
exception if the store is already closed. There is a small window
that allows this to happen during InternalEngine#close() when we try
to acquire the searcher at the same time and the engine is the last
resource that holds a reference to the store.

This commit only affects unreleased code since the Store's ref counting
has not yet been released.