From 25b3f63fbd5f97d2b287e0304aef807de3114ee7 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Sun, 26 Dec 2010 22:55:32 +0000 Subject: [PATCH] LUCENE-2825: Change FSDirectory.open to return MMap on 64-bit Solaris git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1052980 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/CHANGES.txt | 4 ++-- .../org/apache/lucene/store/FSDirectory.java | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 17852b48009..d93f2723b26 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -121,8 +121,8 @@ Changes in backwards compatibility policy 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) diff --git a/lucene/src/java/org/apache/lucene/store/FSDirectory.java b/lucene/src/java/org/apache/lucene/store/FSDirectory.java index d2eb3b6c7e6..fcb79138fb5 100644 --- a/lucene/src/java/org/apache/lucene/store/FSDirectory.java +++ b/lucene/src/java/org/apache/lucene/store/FSDirectory.java @@ -161,10 +161,10 @@ public abstract class FSDirectory extends Directory { * best implementation given the current environment. * The directory returned uses the {@link NativeFSLockFactory}. * - *

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 + *

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 extends Directory { /** 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); }