users@glassfish.java.net

How to build something like a request counter for a stateless session bean?

From: <glassfish_at_javadesktop.org>
Date: Fri, 07 Sep 2007 07:20:13 PDT

Hallo!
How to build something like a request counter for a stateless session bean (maybe offering the interface as web service)?

Should I use Entity Bean without version attribute, and update it every request?
Problem: the locking will slow down the System, and the commit takes a long time.

Should I use a Message Driven Bean, and update the EntityBean only every 10 Request or so?

Should I count the request in the session bean, an bulk update the entity Bean?
Problem: the bulk update will slow down the request where the bulk update takes place, and I don't think this is conform with the EJB specification.

Should I use ehCache and put a statistic Object in the cache with synchronized count methods?
Problem: This will not work in a clustered scenario.

I know there must be a solution, glassfish itself can count the web service request.
Jboss offers something like a singleton bean, would this work, has glassfish something similar?

How to solve this problem, and what about if the application runs on a cluster?


Thanks for your time
    -stephan
[Message sent by forum member 'iceandfire' (iceandfire)]

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