Statistics
Hey, I have a general programming question which I hope I can get some idea from you guys, I have an EJB (message-driven) application which perform information enquiry/maintence, what I want to do is to collect some stat such as
- number of messages per day
- number of messages in each catagory (i.e enquiry/maintence)
- respond time (request receive - respond send)
what would be the best approach to go around this problem? thanks!
[465 byte] By [
mpanga] at [2007-10-3 2:50:33]

Well, about the messages: I think this would be time where you need a proxy, which collects all events, redistributes them and counts them on the same time.
However, I have no idea how you could test your response time. I'd suggest to insert a control message once in a while, which contains a time stamp when it was send and the content "please send me back immediately". This is the way ATM cells diagnose their network status.
the application is basically a search engine, I get a message (XML) then I dispatch the request to it's corresponding service, after a certain time I get the respond back, I am thinking to do this collect stat in my bean class, someone suggest to write a stat entry to a file, then at night conclude the entire stat. any thought?
mpanga at 2007-7-14 20:39:23 >

> Hey, I have a general programming question which I
> hope I can get some idea from you guys, I have an EJB
> (message-driven) application which perform
> information enquiry/maintence, what I want to do is
> to collect some stat such as
>
>- number of messages per day
> - number of messages in each catagory (i.e
> enquiry/maintence)
>- respond time (request receive - respond send)
> at would be the best approach to go around this
> problem? thanks!
Couldn't you just throw some static variables in your MDB and icrament them accordingly in the onMessage method. then you can poll and reset that data with some sort of timertask started up by a servlet. Store the reports in a DB for you to consume....or do the latter part however you want.
Seems easy enough.
Well you certainly don't need to do that, but if you want to check your information every 12 hours or so then a TimerTask would probably be the best way to go.
http://rangiroa.essi.fr/cours/systeme1/thread/tutorial/thread/timer.html
It basically kicks off a thread over and over again with a specific delay in between.
Thanks again Norweed! So I could simply have a set of static variables to keep track of all the stats that I needed, then at 12:00 am everyday, start a TimerTask to write the result to a file?
mpanga at 2007-7-14 20:39:23 >
