Skip to content

Apache Lucene open-source search software

we don't want to throw an exception on closed in release

Mark Robert Miller02dfa0a4a8c1
diff --git a/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
index f6ac3ef2c92..d20992d4f25 100644
--- a/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
@@ -150,9 +150,8 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
private void close(Directory directory) throws IOException {
synchronized (this) {
- if (closed) {
- throw new RuntimeException("Already closed");
- }
+ // don't check if already closed here - we need to able to release
+ // while #close() waits.
CacheValue cacheValue = byDirectoryCache.get(directory);
if (cacheValue == null) {