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
This commit is contained in:
Robert Muir 2010-12-26 22:55:32 +00:00
parent 75a5bde690
commit 25b3f63fbd
2 changed files with 11 additions and 11 deletions

View File

@ -121,8 +121,8 @@ Changes in backwards compatibility policy
Changes in Runtime Behavior Changes in Runtime Behavior
* LUCENE-2650: The behavior of FSDirectory.open has changed. On 64-bit * LUCENE-2650, LUCENE-2825: The behavior of FSDirectory.open has changed. On 64-bit
Windows systems that support unmapping, FSDirectory.open returns Windows and Solaris systems that support unmapping, FSDirectory.open returns
MMapDirectory. Additionally the behavior of MMapDirectory has been MMapDirectory. Additionally the behavior of MMapDirectory has been
changed to enable unmapping by default if supported by the JRE. changed to enable unmapping by default if supported by the JRE.
(Mike McCandless, Uwe Schindler, Robert Muir) (Mike McCandless, Uwe Schindler, Robert Muir)

View File

@ -161,10 +161,10 @@ public abstract class FSDirectory extends Directory {
* best implementation given the current environment. * best implementation given the current environment.
* The directory returned uses the {@link NativeFSLockFactory}. * The directory returned uses the {@link NativeFSLockFactory}.
* *
* <p>Currently this returns {@link NIOFSDirectory} * <p>Currently this returns {@link MMapDirectory} for most Solaris
* on non-Windows JREs, {@link MMapDirectory} on 64-bit * and Windows 64-bit JREs, {@link NIOFSDirectory} for other
* Sun Windows JREs, and {@link SimpleFSDirectory} for other * non-Windows JREs, and {@link SimpleFSDirectory} for other
* JRes on Windows. It is highly recommended that you consult the * JREs on Windows. It is highly recommended that you consult the
* implementation's documentation for your platform before * implementation's documentation for your platform before
* using this method. * using this method.
* *
@ -184,10 +184,10 @@ public abstract class FSDirectory extends Directory {
/** Just like {@link #open(File)}, but allows you to /** Just like {@link #open(File)}, but allows you to
* also specify a custom {@link LockFactory}. */ * also specify a custom {@link LockFactory}. */
public static FSDirectory open(File path, LockFactory lockFactory) throws IOException { public static FSDirectory open(File path, LockFactory lockFactory) throws IOException {
if (Constants.WINDOWS) { if ((Constants.WINDOWS || Constants.SUN_OS)
if (MMapDirectory.UNMAP_SUPPORTED && Constants.JRE_IS_64BIT) && Constants.JRE_IS_64BIT && MMapDirectory.UNMAP_SUPPORTED) {
return new MMapDirectory(path, lockFactory); return new MMapDirectory(path, lockFactory);
else } else if (Constants.WINDOWS) {
return new SimpleFSDirectory(path, lockFactory); return new SimpleFSDirectory(path, lockFactory);
} else { } else {
return new NIOFSDirectory(path, lockFactory); return new NIOFSDirectory(path, lockFactory);