You can put an atomic incrementor in your EJB:

        int count = 0;

        private incremenetCallCount() {
        
                count++;
        
        }

        public getCallCount() {

                return count;
        }

        public resetCount() {
                count = 0;
        }


        These are not synchronized, but they you shouldn't access threading
in your EJB. Anyway, the count will be really dyanmic, so you might lose one
here and there on a call to reset. 

        But then you could deploy a Model MBean for this in Jboss to read
the getCallCount() method.

        If you look at
http://sourceforge.net/project/showfiles.php?group_id=53232&release_id=92640

        the dynamicManagement package contains a few classes that dynamicall
create model mbeans. The package has an example server that will start a
local JMX agent, then scan a JNDI tree, and then use introspection to create
a model mbean for each object or EJB listed in your JNDI tree.

        You could then look at all the MBeans in that JMX agent to monitor
how many times your EJB's are called. Or you could use the source to see how
to deploy it right into JBoss.

        hope that helps,
        lucas mcgregor

-----Original Message-----
From: Michael Klem [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 12:50 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [JBoss-user] JMX & JBoss question


I am using JMX with JBoss 2.4.4 and came across a confusing 
situation. I want to use JMX to monitor how many times each ejb is 
called and how long each ejb takes to process a specific command.

It seems that to make this work easily I would have to create one 
mbean for each ejb. For example, EJB1MBean, EJB2MBean, EJB3MBean. 
This is not good since the code in each MBean would be identical. 
This will, however, allow me to view the data in my browser.

I would prefer to have an MBean that uses a hashmap to contain an 
MBean for each ejb. If I do this, I cannot view the MBeans contained 
in the hashmap.

I am currently reading about dynamic MBeans. Any ideas?
-- 
"If something is too hard, give up. The moral my boy is to never try 
anything." - Homer


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to