|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
NotificationListenerBonjour,
I have a question about NotificationListeners and network failure.
If I bind a NotificationListener on an MBean and the connection between the listener and the MBean drop, will the NotificationListener still be called when the connection return?
When I create the JMXConnector, I add a ConnectionNotificationListener: JMXConnector jmxc; private void createConnection(JMXServiceURL url){ jmxc = JMXConnectorFactory.connect(url, null); jmxc.addConnectionNotificationListener(this, null, this); }
When I get a notification that the connection dropped, I reset the old connection and create a new one: public void handleNotification(Notification notification, Object handback) { String notificationType = notification.getType(); if (notificationType.equals(JMXConnectionNotification.CLOSED) || notificationType.equals(JMXConnectionNotification.FAILED)) { // Remove the listener to avoid infinite recursion jmxc.removeConnectionNotificationListener(JmxContext.this); try { jmxc.close(); } catch (IOException e) { // Don’t care }
if(the connection should really be closed){ return; }
// Create the new connection createConnection(); } }
So back to the question, If somebody added a MBean NotificationListener using: mbsc.addNotificationListener(new ObjectName(name), listener, null, null);
and the connection drop. When the connectionNotificationListener recreate the connection, will the NotificationListener on the MBean will still be valid? Will it continue to receive notifications? If not, will this create a NotificationListener leak on the server side?
Thank you very much.
Manuel
P.S.: Do you have any documentation on how the connection failures are handled by JMX or the rmi connector? |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |