Close indexes as they are removed from the IndexCollection
Change-Id: I71cf370be094ae1eba73b2dec9e0dfec3b9a5c09
This commit is contained in:
@@ -109,7 +109,7 @@ public class LuceneIndexModule extends LifecycleModule {
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
index.close();
|
||||
// Do nothing; indexes are closed by IndexCollection.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,5 +220,6 @@ class LuceneVersionManager implements LifecycleListener {
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
// Do nothing; indexes are closed on demand by IndexCollection.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,10 @@ public class IndexCollection implements LifecycleListener {
|
||||
}
|
||||
|
||||
public void setSearchIndex(ChangeIndex index) {
|
||||
searchIndex.set(index);
|
||||
ChangeIndex old = searchIndex.getAndSet(index);
|
||||
if (old != null && old != index) {
|
||||
old.close();
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<ChangeIndex> getWriteIndexes() {
|
||||
@@ -76,7 +79,11 @@ public class IndexCollection implements LifecycleListener {
|
||||
}
|
||||
}
|
||||
if (removeIndex >= 0) {
|
||||
writeIndexes.remove(removeIndex);
|
||||
try {
|
||||
writeIndexes.get(removeIndex).close();
|
||||
} finally {
|
||||
writeIndexes.remove(removeIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user