coheigea commented on a change in pull request #11463: FLINK-16697 - Disable JMX rebinding URL: https://github.com/apache/flink/pull/11463#discussion_r398030984
########## 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 { + private final String lookupName; + + JmxRegistry(final int port, final String lookupName) throws RemoteException { + super(port); + this.lookupName = lookupName; + } + + @Override + public Remote lookup(String s) throws RemoteException, NotBoundException { + return lookupName.equals(s) ? remoteServerStub : null; Review comment: Yes, good point, this could probably be improved a bit. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services