You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2010/12/26 23:55:32 UTC

svn commit: r1052980 - in /lucene/dev/trunk/lucene: CHANGES.txt src/java/org/apache/lucene/store/FSDirectory.java

Author: rmuir
Date: Sun Dec 26 22:55:32 2010
New Revision: 1052980

URL: http://svn.apache.org/viewvc?rev=1052980&view=rev
Log:
LUCENE-2825: Change FSDirectory.open to return MMap on 64-bit Solaris

Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FSDirectory.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1052980&r1=1052979&r2=1052980&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Sun Dec 26 22:55:32 2010
@@ -121,8 +121,8 @@ Changes in backwards compatibility polic
 
 Changes in Runtime Behavior
 
-* LUCENE-2650: The behavior of FSDirectory.open has changed. On 64-bit
-  Windows systems that support unmapping, FSDirectory.open returns
+* LUCENE-2650, LUCENE-2825: The behavior of FSDirectory.open has changed. On 64-bit
+  Windows and Solaris systems that support unmapping, FSDirectory.open returns
   MMapDirectory. Additionally the behavior of MMapDirectory has been
   changed to enable unmapping by default if supported by the JRE.
   (Mike McCandless, Uwe Schindler, Robert Muir)

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FSDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FSDirectory.java?rev=1052980&r1=1052979&r2=1052980&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FSDirectory.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/store/FSDirectory.java Sun Dec 26 22:55:32 2010
@@ -161,10 +161,10 @@ public abstract class FSDirectory extend
    *  best implementation given the current environment.
    *  The directory returned uses the {@link NativeFSLockFactory}.
    *
-   *  <p>Currently this returns {@link NIOFSDirectory}
-   *  on non-Windows JREs, {@link MMapDirectory} on 64-bit 
-   *  Sun Windows JREs, and {@link SimpleFSDirectory} for other
-   *  JRes on Windows. It is highly recommended that you consult the
+   *  <p>Currently this returns {@link MMapDirectory} for most Solaris
+   *  and Windows 64-bit JREs, {@link NIOFSDirectory} for other
+   *  non-Windows JREs, and {@link SimpleFSDirectory} for other
+   *  JREs on Windows. It is highly recommended that you consult the
    *  implementation's documentation for your platform before
    *  using this method.
    *
@@ -184,11 +184,11 @@ public abstract class FSDirectory extend
   /** Just like {@link #open(File)}, but allows you to
    *  also specify a custom {@link LockFactory}. */
   public static FSDirectory open(File path, LockFactory lockFactory) throws IOException {
-    if (Constants.WINDOWS) {
-      if (MMapDirectory.UNMAP_SUPPORTED && Constants.JRE_IS_64BIT)
-        return new MMapDirectory(path, lockFactory);
-      else
-        return new SimpleFSDirectory(path, lockFactory);
+    if ((Constants.WINDOWS || Constants.SUN_OS)
+          && Constants.JRE_IS_64BIT && MMapDirectory.UNMAP_SUPPORTED) {
+      return new MMapDirectory(path, lockFactory);
+    } else if (Constants.WINDOWS) {
+      return new SimpleFSDirectory(path, lockFactory);
     } else {
       return new NIOFSDirectory(path, lockFactory);
     }