Skip to content

Commit

Permalink
ARTEMIS-4751 upgrade to Apache parent 32
Browse files Browse the repository at this point in the history
Due to apache/maven-apache-parent#188 the
property `maven.compiler.release` is now being set which precludes
exporting and using any internal Java classes. Therefore this commit
removed references to `--add-exports` from the build and removed any
usage of the relevant classes from the code-base.
  • Loading branch information
jbertram committed May 1, 2024
1 parent 817dc41 commit ac02855
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 105 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
16 changes: 1 addition & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>31</version>
<version>32</version>
<relativePath>org.apache:apache</relativePath>
</parent>

Expand Down Expand Up @@ -340,8 +340,6 @@
<configuration>
<compilerArgs>
<arg>-Xdiags:verbose</arg>
<arg>--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED</arg>
<arg>--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED</arg>
<arg>-XDcompilePolicy=simple</arg>
<arg>-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/.*</arg>
</compilerArgs>
Expand Down Expand Up @@ -376,8 +374,6 @@
<fork>true</fork>
<compilerArgs>
<arg>-Xdiags:verbose</arg>
<arg>--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED</arg>
<arg>--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED</arg>
<arg>-XDcompilePolicy=simple</arg>
<arg>-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/.*</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
Expand Down Expand Up @@ -829,16 +825,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<showWarnings>true</showWarnings>
<compilerArgs>
<arg>--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-rar-plugin</artifactId>
Expand Down
10 changes: 0 additions & 10 deletions tests/smoke-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>--add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED</arg>
<arg>--add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit ac02855

Please sign in to comment.