简体   繁体   中英

JMX Connection and Session handling

I'm currently building a monitoring facility based on JMX. The system to be monitored already exposes some KPIs in a publish/subscribe manner, ie a custom coded monitoring client can connect to the system, activate and subscribe to such KPIs and the system then notifies the client as soon as a new KPI value is available. As evaluation of those KPIs may be computationally expensive, only those KPIs having at least on subscribed client are evaluated.

My task now is to extend the system providing a monitoring server based on JMX and JMX Notifications so that any JMX client can activate, subscribe and receive those KPIs.

The problem I face is: Each connected client changes some state on the server (ie activates KPIs and registers some Listeners) which I need to clean up as soon as the client's session is done or failed due to a connection loss.

Concerning sessions the JMX specification states in chapter 13.1:

A session has state on the client, notably its listeners (see Section 13.4 “Adding Remote Listeners” on page 208). A session does not necessarily have state on the server, and for the two connectors defined by this specification, it does not.

Does anyone know of a JMXConnectorServer implementation allowing to maintain some session state? Any code sample, tutorial or guidance in implementing such a server would also be highly appreciated.

Maybe you can have something like a clientId, where when you're registering the listeners, you take clientId as an argument, so the server would have some client side information.

When the client side gently shuts down, it can call a method to the JMX server to clear the listener, or if the client side loses the connection and couldn't gently closes, you can have a monitoring thread on the client side which registers who are listening and closing, and notifies the JMX server if necessary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM