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

View File

@ -161,10 +161,10 @@ public abstract class FSDirectory extends Directory {
* 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 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);
}