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

fix(registration): correctly annotate with JMX port number #157

Merged
merged 2 commits into from
Jun 20, 2023

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented Jun 20, 2023

Fixes #153

Copy link
Member

@tthvo tthvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Fixed the issue (PORT annotation?).

Wondering why previously it does not behave correctly as it seemed to work?

@andrewazores
Copy link
Member Author

$ jshell
|  Welcome to JShell -- Version 17.0.7
|  For an introduction type: /help intro

jshell> URI.create("service:jmx:rmi:///jndi/rmi://localhost:1234/jmxrmi")
$1 ==> service:jmx:rmi:///jndi/rmi://localhost:1234/jmxrmi

jshell> URI.create("service:jmx:rmi:///jndi/rmi://localhost:1234/jmxrmi").getPort()
$2 ==> -1

jshell> URI.create("service:jmx:rmi:///jndi/rmi://localhost:1234/jmxrmi").getSchemeSpecificPart()
$3 ==> "jmx:rmi:///jndi/rmi://localhost:1234/jmxrmi"

The JMX service URL format's port number is not actually the URI's port number, but embedded within the "scheme-specific part" of the URI. So, the regular .getPort() method simply returns -1 instead of what would be expected as the JMX port number. The rest of everything in this call chain works fine and puts the value into the right place, I just overlooked that this value will be wrong in the "prefer JMX" case.

@tthvo
Copy link
Member

tthvo commented Jun 20, 2023

Ahh okayy that makes sense! Thanks for explaining!

@andrewazores andrewazores merged commit 34cdd78 into cryostatio:main Jun 20, 2023
@andrewazores andrewazores deleted the gh153 branch June 20, 2023 18:22
mergify bot pushed a commit that referenced this pull request Jun 20, 2023
andrewazores added a commit that referenced this pull request Jun 20, 2023
(cherry picked from commit 34cdd78)

Co-authored-by: Andrew Azores <aazores@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

[Bug] Discovery self-node has wrong annotation port number when publishing JMX URL
2 participants