You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by nk...@apache.org on 2020/03/20 10:00:39 UTC

[zookeeper] branch branch-3.6 updated: ZOOKEEPER-3739: Remove unsupported com.sun API

This is an automated email from the ASF dual-hosted git repository.

nkalmar pushed a commit to branch branch-3.6
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/branch-3.6 by this push:
     new d3ac233  ZOOKEEPER-3739: Remove unsupported com.sun API
d3ac233 is described below

commit d3ac2334bcb380f35ffd55a19b3ac0a02ef2aace
Author: Christopher Tubbs <ct...@apache.org>
AuthorDate: Fri Mar 20 11:00:13 2020 +0100

    ZOOKEEPER-3739: Remove unsupported com.sun API
    
    Remove unsupported use of com.sun.nio.file.SensitivityWatchEventModifier
    to better support builds against newer JDKs.
    
    Also update build tooling to use strict JDK release compatibility when
    building with newer JDKs by adding profiles which automatically activate
    the correct compiler flag when the newer JDK is detected when building
    with Maven or Eclipse.
    
    Author: Christopher Tubbs <ct...@apache.org>
    
    Reviewers: Enrico Olivelli <eo...@apache.org>, Norbert Kalmar <nk...@apache.org>
    
    Closes #1269 from ctubbsii/ZK-3739
    
    (cherry picked from commit 8148f966947d3ecf3db0b756d93c9ffa88174af9)
    Signed-off-by: Norbert Kalmar <nk...@apache.org>
---
 pom.xml                                            | 22 +++++++++++++++++++++-
 .../apache/zookeeper/common/FileChangeWatcher.java |  3 +--
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 33d5b5b..59726b6 100755
--- a/pom.xml
+++ b/pom.xml
@@ -307,6 +307,26 @@
             </plugins>
         </build>
     </profile>
+    <profile>
+      <id>m2e</id>
+      <activation>
+        <property>
+          <name>m2e.version</name>
+        </property>
+      </activation>
+      <properties>
+        <maven.compiler.release>8</maven.compiler.release>
+      </properties>
+    </profile>
+    <profile>
+      <id>jdk-release-flag</id>
+      <activation>
+        <jdk>[9,)</jdk>
+      </activation>
+      <properties>
+        <maven.compiler.release>8</maven.compiler.release>
+      </properties>
+    </profile>
   </profiles>
 
   <properties>
@@ -528,7 +548,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
-          <version>3.8.0</version>
+          <version>3.8.1</version>
           <configuration>
              <showWarnings>true</showWarnings>
              <compilerArgs>
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/common/FileChangeWatcher.java b/zookeeper-server/src/main/java/org/apache/zookeeper/common/FileChangeWatcher.java
index 5410c89..274e212 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/common/FileChangeWatcher.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/common/FileChangeWatcher.java
@@ -18,7 +18,6 @@
 
 package org.apache.zookeeper.common;
 
-import com.sun.nio.file.SensitivityWatchEventModifier;
 import java.io.IOException;
 import java.nio.file.ClosedWatchServiceException;
 import java.nio.file.FileSystem;
@@ -72,7 +71,7 @@ public final class FileChangeWatcher {
 
         LOG.debug("Registering with watch service: {}", dirPath);
 
-        dirPath.register(watchService, new WatchEvent.Kind<?>[]{StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.OVERFLOW}, SensitivityWatchEventModifier.HIGH);
+        dirPath.register(watchService, new WatchEvent.Kind<?>[]{StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.OVERFLOW});
         state = State.NEW;
         this.watcherThread = new WatcherThread(watchService, callback);
         this.watcherThread.setDaemon(true);