diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/MicrosClock.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/MicrosClock.java
deleted file mode 100644
index 29875b6e4089..000000000000
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/MicrosClock.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.activemq.artemis.cli.commands.messages.perf;
-
-import java.util.concurrent.TimeUnit;
-
-public class MicrosClock {
-
- // no need for volatile here
- private static long offset = -1;
- private static long NANOS_PER_SECOND = TimeUnit.SECONDS.toNanos(1);
-
- private static final boolean AVAILABLE = checkAvailable();
-
- private static boolean checkAvailable() {
- try {
- final long now = now();
- if (now < 0) {
- return false;
- }
- return true;
- } catch (Throwable t) {
- return false;
- }
- }
-
- public static boolean isAvailable() {
- return AVAILABLE;
- }
-
- public static long now() {
- long epochSecond = offset;
- long nanoAdjustment = jdk.internal.misc.VM.getNanoTimeAdjustment(epochSecond);
-
- if (nanoAdjustment == -1) {
- epochSecond = System.currentTimeMillis() / 1000 - 1024;
- nanoAdjustment = jdk.internal.misc.VM.getNanoTimeAdjustment(epochSecond);
- if (nanoAdjustment == -1) {
- throw new InternalError("Offset " + epochSecond + " is not in range");
- } else {
- offset = epochSecond;
- }
- }
- final long secs = Math.addExact(epochSecond, Math.floorDiv(nanoAdjustment, NANOS_PER_SECOND));
- final long secsInUs = TimeUnit.SECONDS.toMicros(secs);
- final long nsOffset = (int) Math.floorMod(nanoAdjustment, NANOS_PER_SECOND);
- final long usOffset = TimeUnit.NANOSECONDS.toMicros(nsOffset);
- return secsInUs + usOffset;
- }
-
-}
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfConsumerCommand.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfConsumerCommand.java
index 1465306105a3..0d439287883f 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfConsumerCommand.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfConsumerCommand.java
@@ -50,11 +50,6 @@ protected void onExecuteBenchmark(final ConnectionFactory factory,
final Destination[] jmsDestinations,
final ActionContext context) throws Exception {
MicrosTimeProvider timeProvider = () -> TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis());
- if (MicrosClock.isAvailable()) {
- timeProvider = MicrosClock::now;
- } else {
- context.err.println("Microseconds wall-clock time not available: using System::currentTimeMillis. Add --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED to the JVM parameters to enable it.");
- }
if (connections == 0) {
if (sharedSubscription > 0) {
if (clientID == null) {
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfProducerCommand.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfProducerCommand.java
index 0e8d58464f46..15e1fb48682d 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfProducerCommand.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfProducerCommand.java
@@ -77,11 +77,6 @@ protected void onExecuteBenchmark(final ConnectionFactory factory,
context.err.println("ClientID configuration is not supported");
}
MicrosTimeProvider timeProvider = () -> TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis());
- if (MicrosClock.isAvailable()) {
- timeProvider = MicrosClock::now;
- } else {
- context.err.println("Microseconds wall-clock time not available: using System::currentTimeMillis. Add --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED to the JVM parameters to enable it.");
- }
final int totalProducers = producersPerDestination * jmsDestinations.length;
diff --git a/pom.xml b/pom.xml
index 63cfab396c62..6c992fe5174c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
org.apache
apache
- 31
+ 32
org.apache:apache
@@ -340,8 +340,6 @@
-Xdiags:verbose
- --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
- --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED
-XDcompilePolicy=simple
-Xplugin:ErrorProne -Xep:ThreadLocalUsage:ERROR -Xep:MissingOverride:ERROR -Xep:NonAtomicVolatileUpdate:ERROR -Xep:SynchronizeOnNonFinalField:ERROR -Xep:StaticQualifiedUsingExpression:ERROR -Xep:WaitNotInLoop:ERROR -Xep:BanJNDI:OFF -XepExcludedPaths:.*/generated-sources/.*
@@ -376,8 +374,6 @@
true
-Xdiags:verbose
- --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
- --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED
-XDcompilePolicy=simple
-Xplugin:ErrorProne -Xep:ThreadLocalUsage:ERROR -Xep:MissingOverride:WARN -Xep:NonAtomicVolatileUpdate:ERROR -Xep:SynchronizeOnNonFinalField:ERROR -Xep:StaticQualifiedUsingExpression:ERROR -Xep:WaitNotInLoop:ERROR -Xep:BanJNDI:OFF -XepExcludedPaths:.*/generated-sources/.*
-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
@@ -829,16 +825,6 @@
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- true
-
- --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED
-
-
-
org.apache.maven.plugins
maven-rar-plugin
diff --git a/tests/smoke-tests/pom.xml b/tests/smoke-tests/pom.xml
index 786d4d7486b9..e442fd85169d 100644
--- a/tests/smoke-tests/pom.xml
+++ b/tests/smoke-tests/pom.xml
@@ -291,16 +291,6 @@
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- --add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED
- --add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED
-
-
-
org.apache.activemq
artemis-maven-plugin
diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmx/JmxConnectionTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmx/JmxConnectionTest.java
index d7721906f9d6..1d8fbd5fca0f 100644
--- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmx/JmxConnectionTest.java
+++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmx/JmxConnectionTest.java
@@ -24,6 +24,7 @@
import javax.management.remote.rmi.RMIConnector;
import java.io.File;
import java.lang.reflect.Field;
+import java.lang.reflect.Method;
import java.rmi.server.RemoteObject;
import java.rmi.server.RemoteRef;
@@ -36,8 +37,6 @@
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import sun.rmi.server.UnicastRef;
-import sun.rmi.transport.LiveRef;
/**
* This test checks JMX connection to Artemis with both necessary ports set up so that it's easier to tunnel through
@@ -142,12 +141,13 @@ public void testJmxConnection() throws Throwable {
remoteRefField = (RemoteRef) UnsafeAccess.UNSAFE.getObject(remoteRef, UnsafeAccess.UNSAFE.objectFieldOffset(refField));
}
Assert.assertNotNull(remoteRefField);
- Assert.assertTrue(remoteRefField instanceof UnicastRef);
+ Assert.assertEquals("sun.rmi.server.UnicastRef2", remoteRefField.getClass().getTypeName());
// 5. UnicastRef::getLiveRef returns LiveRef
- LiveRef liveRef = ((UnicastRef) remoteRefField).getLiveRef();
+ Method getLiveRef = remoteRefField.getClass().getMethod("getLiveRef");
+ Object liveRef = getLiveRef.invoke(remoteRefField);
- Assert.assertEquals(RMI_REGISTRY_PORT, liveRef.getPort());
+ Assert.assertEquals(RMI_REGISTRY_PORT, liveRef.getClass().getMethod("getPort").invoke(liveRef));
} finally {
jmxConnector.close();