jetty.project
jetty.project copied to clipboard
JMX listener/logging
Would be great to introduce a JMX listener, or at least logging (which can be implemented as a logging listener), when the JMX infrastructure invokes Jetty's MBeans.
Applications can then know when JMX methods are invoked (and possibly by whom or at least know the stack trace) and log that activity.
The listener would be invoked for getAttribute()
, setAttribute()
and invoke()
JMX methods, and multiple listeners could be attached to MBeanContainer
.
Seems like this already exists in the JVM ...
@joakime those are not good as they only convey information for bean property changes.
For JMX we would need JMX metadata and cover the invoke()
semantic.
for JMX Attributes there's already ...
For a JMX Operation, that would just be a normal Notification
and NotificationListener
Wouldn't it make more sense to ensure support for what's already there vs creating a new API that only works with our MBean layer?
I'll look into this.
I just tried it, it would require each MBean that we care to listen to, to implement the javax.management.NotificationBroadcaster
.
These exist, but it's not like it's all that easy to use.
No, AttributeChangeNotification
must be emitted by the MBean implementation itself.
We don't do that in ObjectMBean
ourselves.
There is no standard for operation notifications. It would be impossible to detect if a notification is emitted as a result of a JMX invocation (e.g. carrying method name and the result if the invocation), or as a result of some other event emitted by the MBean (e.g. timer events or other events that follow an invocation).
Both AttributeChangeNotification
and OperationInvocationNotification
could be implemented in a listener.
For non-ObjectMBean
s, unfortunately, we won't have these new events.
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.
There are 2 approaches:
- Introduce
ObjectMBean.Listener
as a custom interface so that application can register listeners and be notified of attribute events or invocation - Use JMX built-in
NotificationEmitter
support and base as much as possible on JMX classes such asAttributeChangeNotification
. Unfortunately there is no event for operation invocation, which means that the API has be to based onNotification.getUserData()
to be aMap
with a number of predefined keys for objects that applications may need (e.g. the invoked method name, parameters list, invocation result, etc.)
While would be nice to base the implementation of already existing JMX support, it is really too basic and cumbersome. However, it may be supported by tooling that understand JMX notifications so there would be some merit using JMX notifications.
See also comments in #3517.
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.
Also, I think MBeanServer
supports interceptors, it could be an alternative way of supporting this feature.
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been closed due to it having no activity.