users@glassfish.java.net

Re: NotificationListener in AMX

From: <glassfish_at_javadesktop.org>
Date: Tue, 16 Oct 2007 22:15:47 PDT

Hi IIc,
  Thanks for the reply.here are my comments for your reply.
[b]
This is the ObjectName which I am working on "amx:X-ConfigConfig=server-config,X-LogServiceConfig=na,j2eeType=X-ModuleLogLevelsConfig,name=na"
[/b]
"- It's not correct to conclude that no Notification has been sent. It is only accurate to state that one is not being *received*. It could be being sent in fact, just not being received."
[b] I can say that It is not being sent since If another JAVA program updates MBean attributes through programatically,my client is getting notified .There is not change in my client code.[/b]

" the class "MyNotificationListener" is not thread safe--make 'objectName' be 'final'. And why does it implement java.rmi.Remote? There is no reason whatsoever to do that."

[b]It may not be required to implement java.rmi.Remote.I have added to check whether AMX Server is expecting Remote Listeners.
Yes,ObjectName is not threadsafe.But this class is only a test program.[/b]

" Which test method is being used? testAMXNotification()? "
[b] I am using testAMXNotificationRemote() method to test.[/b]

" In testAMXNotification() , you are adding the same NotificationListener "test" to two MBeans. This is not in itself an issue from a JMX perspective, but note that your listener has one variable and can be called for Notifications emitted from the two MBeans, thus printing out only "test", making it impossible to distinguish between them. The variable 'objectName' is not an ObjectName; it's set to "test". "

[b]I am not even getting one printout.And since objectName is type of String and it is meant to differentiate the different notifications.And I am not even getting one notification.So,the problem in distinguish the notification is not yet reached. [/b]

"How do you know that System.out.println() is working within the context it's being called from? Put something nasty in there like System.exit() to verify that it's never being called. "
[b] After adding the NotificationListener to MBean Server,My client program waits (Please check the method(waitForSomething()) being called from testAMXNotificationRemote().[/b]



  Thank you once again for the reply.Please let me know what could be the issue.
[Message sent by forum member 'karanvpraba' (karanvpraba)]

http://forums.java.net/jive/thread.jspa?messageID=240575