Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide GraalVM 20.2.0 JMX compatibility #82

Merged
merged 1 commit into from Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
java: [ 8, 11 ]
graal: [ 20.1.0 ]
graal: [ 20.1.0, 20.2.0 ]

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -43,7 +43,7 @@


<properties>
<quarkus.version>1.8.0.Final</quarkus.version>
<quarkus.version>1.8.1.Final</quarkus.version>
<hazelcast.version>4.0.3</hazelcast.version>

<maven.compiler.source>1.8</maven.compiler.source>
Expand Down Expand Up @@ -276,4 +276,4 @@
</build>
</profile>
</profiles>
</project>
</project>
Expand Up @@ -5,49 +5,18 @@
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

import javax.management.InstanceNotFoundException;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import java.util.Set;

@TargetClass(JmxPublisher.class)
public final class Target_JmxPublisher {

@Alias
private volatile boolean isShutdown;

@Alias
private String domainPrefix;

@Alias
private MBeanServer platformMBeanServer;

@Alias
private String instanceNameEscaped;
@Substitute
public Target_JmxPublisher(String instanceName, String domainPrefix) {
}

@Substitute
public void shutdown() {
isShutdown = true;
try {
// unregister the MBeans registered by this JmxPublisher
// the mBeans map can't be used since it is not thread-safe
// and is meant to be used by the publisher thread only
ObjectName name = new ObjectName(domainPrefix + "*" + ":instance=" + instanceNameEscaped + ",type=Metrics,*");
if (platformMBeanServer == null) {
return;
}
Set<ObjectName> objectNames = platformMBeanServer.queryNames(name, null);
for (ObjectName bean : objectNames) {
unregisterMBeanIgnoreError(bean);
}
} catch (MalformedObjectNameException e) {
throw new RuntimeException("Exception when unregistering JMX beans", e);
}
}

@Alias
private void unregisterMBeanIgnoreError(ObjectName objectName) {
}
}
@@ -0,0 +1,14 @@
package io.quarkus.hazelcast.client.runtime.graal;

import com.hazelcast.config.MetricsJmxConfig;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

@TargetClass(MetricsJmxConfig.class)
public final class Target_MetricsJmxConfig {

@Substitute
public boolean isEnabled() {
return false;
}
}
@@ -1,13 +1,14 @@
package io.quarkus.hazelcast.client.runtime.graal;

import com.hazelcast.internal.util.ServiceLoader;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

import static com.hazelcast.internal.util.Preconditions.isNotNull;

@Substitute
@TargetClass(className = "com.hazelcast.internal.util.ServiceLoader", innerClass = "ServiceDefinition")
final class Target_ServiceDefinition {
@TargetClass(value = ServiceLoader.class, innerClass = "ServiceDefinition")
public final class Target_ServiceDefinition {
private final String className;
private final ClassLoader classLoader;

Expand Down