From 3484479038298f7de9adb8525096fd57ec1cc2fb Mon Sep 17 00:00:00 2001 From: Christopher Tubbs Date: Tue, 25 Feb 2020 13:52:24 -0500 Subject: [PATCH] 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. --- pom.xml | 22 ++++++++++++++++++- .../zookeeper/common/FileChangeWatcher.java | 3 +-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index f5c8f0e5ab5..fc54d768b20 100755 --- a/pom.xml +++ b/pom.xml @@ -307,6 +307,26 @@ + + m2e + + + m2e.version + + + + 8 + + + + jdk-release-flag + + [9,) + + + 8 + + @@ -534,7 +554,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.8.1 true 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 5410c897513..274e2127787 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 FileChangeWatcher(Path dirPath, Consumer> callback) throws 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);