[ASTERIXDB-2397][*DB] Enable build on Java 10
Change-Id: I5ceccc0d3b0d5c508f4777d3cde5753099661322
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2696
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/hyracks-fullstack/hyracks/hyracks-hdfs/hyracks-hdfs-core/pom.xml b/hyracks-fullstack/hyracks/hyracks-hdfs/hyracks-hdfs-core/pom.xml
index 6f4726e..99112c0 100644
--- a/hyracks-fullstack/hyracks/hyracks-hdfs/hyracks-hdfs-core/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-hdfs/hyracks-hdfs-core/pom.xml
@@ -140,7 +140,8 @@
<version>1.0.4</version>
<type>jar</type>
<scope>test</scope>
- </dependency> </dependencies>
+ </dependency>
+ </dependencies>
</profile>
<profile>
@@ -170,23 +171,13 @@
<dependency>
<groupId>org.apache.hyracks</groupId>
<artifactId>hyracks-control-common</artifactId>
- <version>0.3.4-SNAPSHOT</version>
+ <version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
- <exclusions>
- <exclusion>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
diff --git a/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/utils/HttpUtil.java b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/utils/HttpUtil.java
index bdd312d..8d6dfbc 100644
--- a/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/utils/HttpUtil.java
+++ b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/utils/HttpUtil.java
@@ -19,36 +19,23 @@
package org.apache.hyracks.http.server.utils;
import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryPoolMXBean;
-import java.lang.management.MemoryType;
-import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
import java.util.regex.Pattern;
import org.apache.hyracks.http.api.IServletRequest;
import org.apache.hyracks.http.api.IServletResponse;
import org.apache.hyracks.http.server.BaseRequest;
import org.apache.hyracks.http.server.FormUrlEncodedRequest;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import io.netty.buffer.PooledByteBufAllocator;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.handler.codec.http.HttpRequest;
-import io.netty.util.internal.PlatformDependent;
public class HttpUtil {
-
- private static final Logger LOGGER = LogManager.getLogger();
private static final Pattern PARENT_DIR = Pattern.compile("/[^./]+/\\.\\./");
- private static long maxMemUsage = 0L;
private HttpUtil() {
}
@@ -167,53 +154,4 @@
return clusterURL;
}
- @SuppressWarnings("restriction")
- public static synchronized void printMemUsage() {
- StringBuilder report = new StringBuilder();
- report.append("sun.misc.VM.maxDirectMemory: ");
- report.append(sun.misc.VM.maxDirectMemory());
- report.append('\n');
- report.append("sun.misc.SharedSecrets.getJavaNioAccess().getDirectBufferPool().getMemoryUsed(): ");
- report.append(sun.misc.SharedSecrets.getJavaNioAccess().getDirectBufferPool().getMemoryUsed());
- report.append('\n');
- report.append("sun.misc.SharedSecrets.getJavaNioAccess().getDirectBufferPool().getTotalCapacity(): ");
- report.append(sun.misc.SharedSecrets.getJavaNioAccess().getDirectBufferPool().getTotalCapacity());
- report.append('\n');
- report.append("ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage(): ");
- report.append(ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage());
- report.append('\n');
- report.append("---------------------------- Beans ----------------------------");
- report.append('\n');
- List<MemoryPoolMXBean> memPoolBeans = ManagementFactory.getMemoryPoolMXBeans();
- for (MemoryPoolMXBean bean : memPoolBeans) {
- if (bean.isValid() && bean.getType() == MemoryType.NON_HEAP) {
- report.append(bean.getName());
- report.append(": ");
- report.append(bean.getUsage());
- report.append('\n');
- }
- }
- report.append("---------------------------- Netty ----------------------------");
- report.append('\n');
- try {
- Field field = PlatformDependent.class.getDeclaredField("DIRECT_MEMORY_COUNTER");
- field.setAccessible(true);
- AtomicLong usedDirectMemory = (AtomicLong) field.get(null);
- long used = usedDirectMemory.get();
- report.append("Current PlatformDependent.DIRECT_MEMORY_COUNTER: ");
- report.append(used);
- report.append('\n');
- report.append("Maximum PlatformDependent.DIRECT_MEMORY_COUNTER: ");
- maxMemUsage = Math.max(maxMemUsage, used);
- report.append(maxMemUsage);
- report.append('\n');
- report.append('\n');
- } catch (Throwable th) { // NOSONAR
- LOGGER.log(Level.WARN, "Failed to access PlatformDependent.DIRECT_MEMORY_COUNTER", th);
- return;
- }
- report.append("--------------- PooledByteBufAllocator.DEFAULT ----------------");
- report.append(PooledByteBufAllocator.DEFAULT.dumpStats());
- LOGGER.log(Level.INFO, report.toString());
- }
}
diff --git a/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/HttpTestUtil.java b/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/HttpTestUtil.java
new file mode 100644
index 0000000..16efc07
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/HttpTestUtil.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hyracks.http;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+import java.lang.management.MemoryType;
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import io.netty.buffer.PooledByteBufAllocator;
+import io.netty.util.internal.PlatformDependent;
+
+public class HttpTestUtil {
+ private static final Logger LOGGER = LogManager.getLogger();
+ private static long maxMemUsage = 0L;
+
+ public static synchronized void printMemUsage() {
+ StringBuilder report = new StringBuilder();
+ /* TODO: unsupported APIs after java 8
+ report.append("sun.misc.VM.maxDirectMemory: ");
+ report.append(sun.misc.VM.maxDirectMemory());
+ report.append('\n');
+ report.append("sun.misc.SharedSecrets.getJavaNioAccess().getDirectBufferPool().getMemoryUsed(): ");
+ report.append(sun.misc.SharedSecrets.getJavaNioAccess().getDirectBufferPool().getMemoryUsed());
+ report.append('\n');
+ report.append("sun.misc.SharedSecrets.getJavaNioAccess().getDirectBufferPool().getTotalCapacity(): ");
+ report.append(sun.misc.SharedSecrets.getJavaNioAccess().getDirectBufferPool().getTotalCapacity());
+ */
+ report.append('\n');
+ report.append("ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage(): ");
+ report.append(ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage());
+ report.append('\n');
+ report.append("---------------------------- Beans ----------------------------");
+ report.append('\n');
+ List<MemoryPoolMXBean> memPoolBeans = ManagementFactory.getMemoryPoolMXBeans();
+ for (MemoryPoolMXBean bean : memPoolBeans) {
+ if (bean.isValid() && bean.getType() == MemoryType.NON_HEAP) {
+ report.append(bean.getName());
+ report.append(": ");
+ report.append(bean.getUsage());
+ report.append('\n');
+ }
+ }
+ report.append("---------------------------- Netty ----------------------------");
+ report.append('\n');
+ try {
+ Field field = PlatformDependent.class.getDeclaredField("DIRECT_MEMORY_COUNTER");
+ field.setAccessible(true);
+ AtomicLong usedDirectMemory = (AtomicLong) field.get(null);
+ long used = usedDirectMemory.get();
+ report.append("Current PlatformDependent.DIRECT_MEMORY_COUNTER: ");
+ report.append(used);
+ report.append('\n');
+ report.append("Maximum PlatformDependent.DIRECT_MEMORY_COUNTER: ");
+ maxMemUsage = Math.max(maxMemUsage, used);
+ report.append(maxMemUsage);
+ report.append('\n');
+ report.append('\n');
+ } catch (Throwable th) { // NOSONAR
+ LOGGER.log(Level.WARN, "Failed to access PlatformDependent.DIRECT_MEMORY_COUNTER", th);
+ return;
+ }
+ report.append("--------------- PooledByteBufAllocator.DEFAULT ----------------");
+ report.append(PooledByteBufAllocator.DEFAULT.dumpStats());
+ LOGGER.log(Level.INFO, report.toString());
+ }
+}
diff --git a/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/servlet/ChattyServlet.java b/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/servlet/ChattyServlet.java
index e6aedb9..54bb756 100644
--- a/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/servlet/ChattyServlet.java
+++ b/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/servlet/ChattyServlet.java
@@ -20,6 +20,7 @@
import java.util.concurrent.ConcurrentMap;
+import org.apache.hyracks.http.HttpTestUtil;
import org.apache.hyracks.http.api.IServletRequest;
import org.apache.hyracks.http.api.IServletResponse;
import org.apache.hyracks.http.server.AbstractServlet;
@@ -58,6 +59,6 @@
for (int i = 0; i < 100; i++) {
response.outputStream().write(bytes);
}
- HttpUtil.printMemUsage();
+ HttpTestUtil.printMemUsage();
}
}
\ No newline at end of file
diff --git a/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/test/HttpServerTest.java b/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/test/HttpServerTest.java
index 71e84e5..b39a141 100644
--- a/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/test/HttpServerTest.java
+++ b/hyracks-fullstack/hyracks/hyracks-http/src/test/java/org/apache/hyracks/http/test/HttpServerTest.java
@@ -32,10 +32,10 @@
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.hyracks.http.HttpTestUtil;
import org.apache.hyracks.http.server.HttpServer;
import org.apache.hyracks.http.server.InterruptOnCloseHandler;
import org.apache.hyracks.http.server.WebManager;
-import org.apache.hyracks.http.server.utils.HttpUtil;
import org.apache.hyracks.http.servlet.ChattyServlet;
import org.apache.hyracks.http.servlet.SleepyServlet;
import org.apache.logging.log4j.Level;
@@ -147,7 +147,7 @@
try {
try {
for (int i = 0; i < numPatches; i++) {
- HttpUtil.printMemUsage();
+ HttpTestUtil.printMemUsage();
request(numRequests);
for (Future<Void> f : FUTURES) {
f.get();
@@ -155,7 +155,7 @@
FUTURES.clear();
}
} finally {
- HttpUtil.printMemUsage();
+ HttpTestUtil.printMemUsage();
servlet.wakeUp();
for (Future<Void> f : stuck) {
f.get();
@@ -165,7 +165,7 @@
System.err.println("Number of rejections: " + UNAVAILABLE_COUNT.get());
System.err.println("Number of exceptions: " + EXCEPTION_COUNT.get());
webMgr.stop();
- HttpUtil.printMemUsage();
+ HttpTestUtil.printMemUsage();
}
}
@@ -180,7 +180,7 @@
int numRequests = 48;
int numExecutors = 24;
int serverQueueSize = 24;
- HttpUtil.printMemUsage();
+ HttpTestUtil.printMemUsage();
WebManager webMgr = new WebManager();
HttpServer server =
new HttpServer(webMgr.getBosses(), webMgr.getWorkers(), PORT, numExecutors, serverQueueSize);
@@ -197,9 +197,9 @@
Assert.assertEquals(0, UNAVAILABLE_COUNT.get());
Assert.assertEquals(0, OTHER_COUNT.get());
} finally {
- HttpUtil.printMemUsage();
+ HttpTestUtil.printMemUsage();
webMgr.stop();
- HttpUtil.printMemUsage();
+ HttpTestUtil.printMemUsage();
}
}
diff --git a/hyracks-fullstack/pom.xml b/hyracks-fullstack/pom.xml
index 95e1779..69739ba 100644
--- a/hyracks-fullstack/pom.xml
+++ b/hyracks-fullstack/pom.xml
@@ -99,6 +99,20 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jdk.tools</groupId>
+ <artifactId>jdk.tools</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
@@ -505,12 +519,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.20.1</version>
+ <version>2.21.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
- <version>2.20.1</version>
+ <version>2.21.0</version>
</plugin>
<plugin>
<groupId>org.apache.hyracks</groupId>
@@ -677,15 +691,6 @@
</properties>
</profile>
<profile>
- <id>java8</id>
- <activation>
- <jdk>1.8</jdk>
- </activation>
- <properties>
- <jdk.version>1.8</jdk.version>
- </properties>
- </profile>
- <profile>
<id>integration-tests-only</id>
<properties>
<test.includes/>