From d503f4a31fb5078cac5aa2acd957b1ac792634c6 Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Tue, 25 Sep 2012 23:02:14 +0000 Subject: [PATCH] SOLR-3892: Inconsistent locking when accessing cache in CachingDirectoryFactory from RAMDirectoryFactory and MockDirectoryFactory. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1390207 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 3 +++ .../src/java/org/apache/solr/core/RAMDirectoryFactory.java | 2 +- .../src/java/org/apache/solr/core/MockDirectoryFactory.java | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 8895d7db9db..af2e76e8f94 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -373,6 +373,9 @@ Bug Fixes * SOLR-3891: CacheValue in CachingDirectoryFactory cannot be used outside of solr.core package. (phunt via Mark Miller) + +* SOLR-3892: Inconsistent locking when accessing cache in CachingDirectoryFactory + from RAMDirectoryFactory and MockDirectoryFactory. (phunt via Mark Miller) Other Changes ---------------------- diff --git a/solr/core/src/java/org/apache/solr/core/RAMDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/RAMDirectoryFactory.java index 546f52ee199..19824de7ebf 100644 --- a/solr/core/src/java/org/apache/solr/core/RAMDirectoryFactory.java +++ b/solr/core/src/java/org/apache/solr/core/RAMDirectoryFactory.java @@ -36,7 +36,7 @@ public class RAMDirectoryFactory extends StandardDirectoryFactory { @Override public boolean exists(String path) { String fullPath = new File(path).getAbsolutePath(); - synchronized (DirectoryFactory.class) { + synchronized (this) { CacheValue cacheValue = byPathCache.get(fullPath); Directory directory = null; if (cacheValue != null) { diff --git a/solr/test-framework/src/java/org/apache/solr/core/MockDirectoryFactory.java b/solr/test-framework/src/java/org/apache/solr/core/MockDirectoryFactory.java index 4c55dd376be..fed6fab1771 100644 --- a/solr/test-framework/src/java/org/apache/solr/core/MockDirectoryFactory.java +++ b/solr/test-framework/src/java/org/apache/solr/core/MockDirectoryFactory.java @@ -47,7 +47,7 @@ public class MockDirectoryFactory extends CachingDirectoryFactory { @Override public boolean exists(String path) { String fullPath = new File(path).getAbsolutePath(); - synchronized (DirectoryFactory.class) { + synchronized (this) { CacheValue cacheValue = byPathCache.get(fullPath); Directory directory = null; if (cacheValue != null) {