You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Simon Willnauer (JIRA)" <ji...@apache.org> on 2011/06/30 14:20:28 UTC

[jira] [Created] (LUCENE-3266) Improve FileLocking based on Java 1.6

Improve FileLocking based on Java 1.6 
--------------------------------------

                 Key: LUCENE-3266
                 URL: https://issues.apache.org/jira/browse/LUCENE-3266
             Project: Lucene - Java
          Issue Type: Improvement
          Components: core/store
    Affects Versions: 4.0
            Reporter: Simon Willnauer
            Priority: Minor
             Fix For: 4.0


Snippet from NativeFSLockFactory:

{noformat}
/*
* The javadocs for FileChannel state that you should have
* a single instance of a FileChannel (per JVM) for all
* 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.
*/
{noformat}

since we are on 1.6 we should improve this if possible.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org