SOLR-4001: In CachingDirectoryFactory#close, if there are still refs for a Directory outstanding, we need to wait for them to be released before closing.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1402822 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-10-27 17:04:19 +00:00
parent bc3f15a08b
commit a00e1ab23d
2 changed files with 15 additions and 0 deletions

View File

@ -125,6 +125,10 @@ Bug Fixes
* SOLR-3998: Atomic update on uniqueKey field itself causes duplicate document.
(Eric Spencer, yonik)
* SOLR-4001: In CachingDirectoryFactory#close, if there are still refs for a
Directory outstanding, we need to wait for them to be released before closing.
(Mark Miller)
Other Changes
----------------------

View File

@ -111,6 +111,17 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
synchronized (this) {
for (CacheValue val : byDirectoryCache.values()) {
try {
// if there are still refs out, we have to wait for them
int cnt = 0;
while(val.refCnt != 0) {
wait(100);
if (cnt++ >= 100*10*30) {
log.error("Timeout waiting for all directory ref counts to be released");
break;
}
}
assert val.refCnt == 0 : val.refCnt;
val.directory.close();
} catch (Throwable t) {