Click to See Complete Forum and Search --> : EJB Timer Service


saipkjai
December 7th, 2009, 08:53 PM
Hi

Let say there are multiple servlet request from the user and each of the request will result int calling the same EJB method available at the back-end project (back-end and front-end project are 2 separated projects), will the back-end spawn additional threads to handle the request? The reason of being asking this question is that I got a strange occurrence while building a ejb timer service back-end. Initially, when my front-end is deployed onto a AS, it will automatically start a servlet and resulting in creating a timer with ejb timer service at the back-end. Everything looks good. I have other ejb functions that will check the next timeout time and info of the timer and such information will be displayed onto a jsp using ajax.

I got everything working and I can see that there is only 1 timer event running at the back-end from the console. But if I keep refreshing the page and retrieve the next timeout time and info of the timer from jsp, I can see that the back-end suddenly have another timer started and I can see that the timer is running at the initial configuration of my back-end (i have a counter to keep track of how many times does the timer has timeout, in this case, the counter shows 1 for the new timer and x for the old existing timer). I am pretty sure that I did not have any create timer business logic during anywhere on my front-end and back-end except at the start up servlet. If I cancel the timer, both timer will be canceled.

So. It is the multiple ajax request from the jsp resulting in creating another instance or thread of the timer object?

Deliverance
December 8th, 2009, 11:28 AM
each servlet request is processed by a new thread.