mirror of https://github.com/apache/lucene.git
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:
parent
bc3f15a08b
commit
a00e1ab23d
|
@ -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
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue