RFR: 8476: Websocket server is tied to JfrEditor
Marcus Hirt
hirt at openjdk.org
Mon Feb 2 13:11:22 UTC 2026
On Wed, 7 Jan 2026 19:23:18 GMT, Alex Macdonald <aptmac at openjdk.org> wrote:
> This PR addresses JMC-8476, in which the current websocket server implemention ties the server to a JfrEditor page.
>
> At the moment, the Websocket server that is used to send selection data is created from within a JfrEditor page. So every time you open a new recording file, the JfrEditor code tries to start a new websocket server. This is a problem because there is only one field in the JMC settings to set the port number, and it is global to the application. So if I open recording-1, and then use the preferences menu to start the websocket server on port 8029, if I then open up recording-2 it will also try to open a websocket server on port 8029, and fail. As a result, sending data from recording-1 will work, but recording-2 will not (this can be seen in my "before" gif below).
>
> I have extracted the websocket code out into it's own package and made it such that there is one server for the JMC application. So now if you toggle between recordings you can still send data to whatever application you want over websocket.
>
> Before:
> (exception thrown when trying to send events from the second recording)
> 
>
> After:
> (selecting events from multiple recordings now works)
> 
Very nice! :)
Marked as reviewed by hirt (Lead).
-------------
PR Review: https://git.openjdk.org/jmc/pull/698#pullrequestreview-3739301846
PR Review: https://git.openjdk.org/jmc/pull/698#pullrequestreview-3739303305
More information about the jmc-dev
mailing list