zentol commented on a change in pull request #11463: FLINK-16697 - Disable JMX
rebinding
URL: https://github.com/apache/flink/pull/11463#discussion_r401536582
##########
File path:
flink-metrics/flink-metrics-jmx/src/main/java/org/apache/flink/metrics/jmx/JMXReporter.java
##########
@@ -541,5 +552,40 @@ public void stop() throws IOException {
}
}
}
+
+ /*
+ * Better to use the internal API than re-invent the wheel.
+ */
+ @SuppressWarnings("restriction")
+ private class JmxRegistry extends sun.rmi.registry.RegistryImpl
{
Review comment:
This is certainly a bit problematic.
We will need to check whether this work as is on Java 11+ or whether we have
to do any module export business at runtime (ideally we don't, it may not be
worth the effort).
I don't think wrapping the registry is feasible either, the setup is done in
the constructor so any delegation we could setup would happen after the
registry is already accessible.
Creating a custom RMI registry free of `sun` references doesn't seem
realistic either.
From what I can tell we can't get around using internal classes, be it
either directly or via reflection.
I've thought about it some more and maybe we should in fact just drop the
port option. We are replacing code that we already did not really understand
with other code we don't really understand.
This may be something we shouldn't be trying to workaround.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services