Skip to content

Commit

Permalink
synchronize on activeContext lock on close
Browse files Browse the repository at this point in the history
  • Loading branch information
seut committed Apr 3, 2015
1 parent b6bbf63 commit 26eea66
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,13 @@ public void releaseContext(SearchContext context) {
@Override
public void close() {
if (closed.compareAndSet(false, true)) { // prevent double release
Iterator<Integer> it = activeCollectors.keySet().iterator();
while (it.hasNext()) {
Integer jobSearchContextId = it.next();
closeContext(jobSearchContextId, false);
it.remove();
synchronized (lock) {
Iterator<Integer> it = activeCollectors.keySet().iterator();
while (it.hasNext()) {
Integer jobSearchContextId = it.next();
closeContext(jobSearchContextId, false);
it.remove();
}
}
}
}
Expand Down

0 comments on commit 26eea66

Please sign in to comment.