aspose file tools*
The moose likes JBoss/WildFly and the fly likes jmx and invoking its methods in jboss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "jmx and invoking its methods in jboss" Watch "jmx and invoking its methods in jboss" New topic
Author

jmx and invoking its methods in jboss

Preetham Chandrasekhar
Ranch Hand

Joined: Nov 05, 2003
Posts: 98
Hi All,

I have implemented an mbean which has 2 simple methods...start() and stop()...
The start() method instantiates a singleton class which holds on to sessions as a hash...and the stop() method nullifies this singleton...

When I start the server...things seem to be working fine...the singleton class is instantiated and am able to store the sessions etc...which is good...but if I try invoking the stop()/start() methods from the jmx-console of the jboss...though it prints out the debug statements I have in there...the methods dont seem to work - when I invoke them from the jmx-console...

for ex: If I invoke the stop() method...it doesnt seem to nullify the singleton instance...

I am a beginner to jmx...so hope I made my question clear...

I am using jboss4.2 as my AS...

Thanks
Preetham


"In theory, there is no difference between theory and practice. But, in practice, there is."<br /> - Jan L.A. van de Snepscheut
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10266
    
168

but if I try invoking the stop()/start() methods from the jmx-console of the jboss...though it prints out the debug statements I have in there...the methods dont seem to work - when I invoke them from the jmx-console...

for ex: If I invoke the stop() method...it doesnt seem to nullify the singleton instance...


Does the control enter the stop method? You can check this by adding System.out.println statements in that method. And if it does enter this method, then the invoking the stop method from jmx-console is working.

When you say the nullify of singleton instance does not work, how did you test it? Are you sure the instance is not getting created again after you have set the instance to null. Also, can you post the code of this MBean where you are doing these operations?


[My Blog] [JavaRanch Journal]
Shenaz Assu
Ranch Hand

Joined: Sep 21, 2007
Posts: 32
Hi Preetham,

I tried your scenario in my system and its working for me. As Jaikiran said, maybe you should post the code. Then we may able to help you.

Cheers
Shenaz
Preetham Chandrasekhar
Ranch Hand

Joined: Nov 05, 2003
Posts: 98
Thanks for the initiative guys...I fixed the issue...the singleton class contains a hash of sessions...I was just nullifying the singleton class...but later I first nullified the hash and then made the singleton class as null...and its working fine now...weird...but I guess thats how it is...
 
 
subject: jmx and invoking its methods in jboss