-
Notifications
You must be signed in to change notification settings - Fork 463
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
[WFLY-3169] Emit local JMX notifications #82
[WFLY-3169] Emit local JMX notifications #82
Conversation
|
||
public void setMBeanServer(MBeanServer mbs) { | ||
this.mbs = mbs; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this field mutable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setter isn't used anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setter and getter where coming from the implemented MBeanServerForwarder
interface.
But there is no good reason to implement this interface instead of MBeanServer
.
I've updated the code to implement MBeanServer
, rename the class to BlockingNotificationMBeanServer
, remove the getter and setter and flag the field as final
Besides the minor bits above, this looks good except I'm not certain about the exception handling. In a few places the patch ignores a user request, perhaps with a log message. That doesn't seem so good, as the user doesn't know his request has basically failed. Is throwing JMRuntimeException or RuntimeOperationsException better? An issue with RuntimeOperationsException instead of JMRuntimeException is the javadoc for some of the add/removeNotificationListener methods that take the 'ObjectName listener' param specify a particular semantic for RuntimeOperationsException, and this would be a different semantic. The things I'm talking about are:
|
I've updated the commits to fix it based on your comments. I also updated the code to throw exception instead of logging some warnings.
I throw a
Same as above, I replace the warning by throwing a
I have not updated the code here and these 2 types of notifications are not emitted by JMX. Note that if that's still bothering you, I'd prefer to emit them as simple JMX What do you think? |
retest this please |
boolean inExposedModelControllerDomains = isInExposedModelControllerDomains(name); | ||
|
||
if (inExposedModelControllerDomains) { | ||
throw new RuntimeOperationsException(JmxLogger.ROOT_LOGGER.addNotificationListenerNotAllowed(name)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this class really needed? I've not looked 100% but perhaps ServerInterceptorFactory/AccessAuditContext could be extended to record that the request was a remote jmx one. Then these checks could be done in ModelControllerMBeanHelper.xxxNotificationListener().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check if we can use ServerInterceptorFactory/AccessAuditContext instead, that'd be better (I did not notice these classes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have looked an I'm not sure that using ServerInterceptorFactory/AccessAuditContex is the right thing.
Blocking remote notification listener from JMX is a temporary solution until we support RBAC for them and add them to our own management API. Once this is done, this BlockingNotificationMBeanServer
will go away. I'm reluctant to add something to the AccessAuditContext
API to remove it afterwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to using this temporary approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with Jeff in Hipchat
Re: "3) JMXNotificationHandler ignores RESOURCE_ADDED_NOTIFICATION and RESOURCE_REMOVED_NOTIFICATION", I'm fine with just ignoring the registration for these. If we get actual demand for emitting the notifications we can look at exposing them. |
I tested this plus several other PRs in WildFly / WildFly Core Integration Experiments and got a failure I haven't seen before. Looking at the server logging associated with the failed test there's a lot of remoting-jmx stuff: [0m21:38:57,460 WARN [org.jboss.remotingjmx.protocol.v2.ClientConnection](remoting-jmx client-thread-69) Notification recieved for non existant NotificationListener 1 etc, etc for tons of lines. I have no idea if this PR is somehow related. |
I'll investigate: this is likely related to this PR. Jeff Mesnil
|
96e3962
to
9a121e9
Compare
* Emit JMX notifications based on WildFly's own notifications * Notification is supported for JMX connections either in-vm (through ManagementFactory.getPlatformMBeanServer() or WildFly's MBeanServerService) and remotely if the JVM is started with the remote monitoring and management * WildFly remoting-jmx does not support JMX notifications * WildFLy notification are converted to their idiomatic JMX counterpart * WildFly's attribute-value-written is converted to JMX's AttibuteChangeNotification * WildFly's resource-added and resource-removed are converted to JMX's MBeanServerNotifications *and* emitted by the MBeanServerDelegateMBean (like regular MBeans) JIRA: https://issues.jboss.org/browse/WFLY-3169
9a121e9
to
8ae0289
Compare
The WARN were reporting a genuine issue. The PlatformMBeanServer is checking the notification filter/listener before removing them. The check is using object identity. This fails as I was creating a new BlockingNotificationFilter in I have added a map to keep a reference on the |
[WFLY-3169] Emit local JMX notifications
* Emit JMX notifications based on WildFly's own notifications * Notification is supported for JMX connections either in-vm (through ManagementFactory.getPlatformMBeanServer() or WildFly's MBeanServerService) and remotely if the JVM is started with the remote monitoring and management * WildFly remoting-jmx does not support JMX notifications * WildFLy notification are converted to their idiomatic JMX counterpart * WildFly's attribute-value-written is converted to JMX's AttibuteChangeNotification * WildFly's resource-added and resource-removed are converted to JMX's MBeanServerNotifications *and* emitted by the MBeanServerDelegateMBean (like regular MBeans) JIRA: https://issues.jboss.org/browse/WFLY-3169 9.x PR: wildfly/wildfly-core#82
* Emit JMX notifications based on WildFly's own notifications * Notification is supported for JMX connections either in-vm (through ManagementFactory.getPlatformMBeanServer() or WildFly's MBeanServerService) and remotely if the JVM is started with the remote monitoring and management * WildFly remoting-jmx does not support JMX notifications * WildFLy notification are converted to their idiomatic JMX counterpart * WildFly's attribute-value-written is converted to JMX's AttibuteChangeNotification * WildFly's resource-added and resource-removed are converted to JMX's MBeanServerNotifications *and* emitted by the MBeanServerDelegateMBean (like regular MBeans) JIRA: https://issues.jboss.org/browse/WFLY-3169 9.x PR: wildfly/wildfly-core#82
[JBEAP-2377] [WFCORE-1209] validate operation request in BatchRunHand…
ManagementFactory.getPlatformMBeanServer() or WildFly's
MBeanServerService) and remotely if the JVM is started with the remote
monitoring and management
counterpart
AttibuteChangeNotification
MBeanServerNotifications and emitted by the
MBeanServerDelegateMBean (like regular MBeans)
JIRA: https://issues.jboss.org/browse/WFLY-3169