You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2016/02/15 21:45:11 UTC

lucene-solr git commit: LUCENE-6989: Disable MMapDirectory unmap-hack for Java 9

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_5x ed0672ddc -> e977d34b6


LUCENE-6989: Disable MMapDirectory unmap-hack for Java 9


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/e977d34b
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/e977d34b
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/e977d34b

Branch: refs/heads/branch_5x
Commit: e977d34b64e1b0798fce351357db06e8ba8dcb49
Parents: ed0672d
Author: Uwe Schindler <us...@apache.org>
Authored: Mon Feb 15 21:44:57 2016 +0100
Committer: Uwe Schindler <us...@apache.org>
Committed: Mon Feb 15 21:44:57 2016 +0100

----------------------------------------------------------------------
 lucene/CHANGES.txt                                            | 3 +++
 .../core/src/java/org/apache/lucene/store/MMapDirectory.java  | 7 ++++---
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e977d34b/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 7910bad..ecbbd18 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -137,6 +137,9 @@ Bug Fixes
 * LUCENE-7019: Add two-phase iteration to GeoPointTermQueryConstantScoreWrapper.
   (Robert Muir via Nick Knize)
 
+* LUCENE-6989: Disable MMapDirectory unmap-hack for Java 9. Official support
+  will come with Lucene 6.  (Uwe Schindler)
+
 Other
 
 * LUCENE-6924: Upgrade randomizedtesting to 2.3.2. (Dawid Weiss)

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e977d34b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
index 7038a2e..f990c49 100644
--- a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
@@ -163,9 +163,10 @@ public class MMapDirectory extends FSDirectory {
   /**
    * <code>true</code>, if this platform supports unmapping mmapped files.
    */
-  public static final boolean UNMAP_SUPPORTED = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+  public static final boolean UNMAP_SUPPORTED = (Constants.JRE_IS_MINIMUM_JAVA9 == false)
+    && AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
     @Override
-    @SuppressForbidden(reason = "Java 9 Jigsaw whitelists access to sun.misc.Cleaner, so setAccessible works")
+    @SuppressForbidden(reason = "Needs access to private APIs in DirectBuffer and sun.misc.Cleaner to enable hack")
     public Boolean run() {
       try {
         Class<?> clazz = Class.forName("java.nio.DirectByteBuffer");
@@ -315,7 +316,7 @@ public class MMapDirectory extends FSDirectory {
       try {
         AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
           @Override
-          @SuppressForbidden(reason = "Java 9 Jigsaw whitelists access to sun.misc.Cleaner, so setAccessible works")
+          @SuppressForbidden(reason = "Needs access to private APIs in DirectBuffer and sun.misc.Cleaner to enable hack")
           public Void run() throws Exception {
             final Method getCleanerMethod = buffer.getClass()
               .getMethod("cleaner");