lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r904203 - /lucene/java/trunk/src/java/org/apache/lucene/store/NativeFSLockFactory.java
Date Thu, 28 Jan 2010 18:27:34 GMT
Author: markrmiller
Date: Thu Jan 28 18:27:34 2010
New Revision: 904203

URL: http://svn.apache.org/viewvc?rev=904203&view=rev
Log:
update comments for NativeFSLockFactory

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/store/NativeFSLockFactory.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/store/NativeFSLockFactory.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/store/NativeFSLockFactory.java?rev=904203&r1=904202&r2=904203&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/store/NativeFSLockFactory.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/store/NativeFSLockFactory.java Thu Jan 28
18:27:34 2010
@@ -159,12 +159,21 @@
   /*
    * The javadocs for FileChannel state that you should have
    * a single instance of a FileChannel (per JVM) for all
-   * locking against a given file.  To ensure this, we have
-   * a single (static) HashSet that contains the file paths
-   * of all currently locked locks.  This protects against
-   * possible cases where different Directory instances in
-   * one JVM (each with their own NativeFSLockFactory
-   * instance) have set the same lock dir and lock prefix.
+   * locking against a given file (locks are tracked per 
+   * FileChannel instance in Java 1.4/1.5). Even using the same 
+   * FileChannel instance is not completely thread-safe with Java 
+   * 1.4/1.5 though. To work around this, we have a single (static) 
+   * HashSet that contains the file paths of all currently 
+   * locked locks.  This protects against possible cases 
+   * where different Directory instances in one JVM (each 
+   * with their own NativeFSLockFactory instance) have set 
+   * the same lock dir and lock prefix. However, this will not 
+   * work when LockFactorys are created by different 
+   * classloaders (eg multiple webapps). 
+   * 
+   * TODO: Java 1.6 tracks system wide locks in a thread safe manner 
+   * (same FileChannel instance or not), so we may want to 
+   * change this when Lucene moves to Java 1.6.
    */
   private static HashSet<String> LOCK_HELD = new HashSet<String>();
 



Mime
View raw message