Caching of session session bean.

I want to use a stateless session bean as Controller. The controller will then forward requests to relevant process session beans. The controller bean will be called by a MainServlet (or whatever the channel is).

Will the container create multiple session beans for each request, and will they be cached automatically?

If only one instance is used, will I have to worry about making it thread safe.

[432 byte] By [jaco@cyberseal.co.za] at [2007-9-26 3:21:03]
# 1

Hi,

your application server will create a pool of session beans. These beans come out from the pool to serve a client and then come back to the pool...so a few stateless session bean can serve a lot of clients...

I think that you should better implement your controler as a servlet (your Mainservlet could be a good candidate singleton). And that servlet could be responsible for calling your stateless session bean...

Bye

javamad at 2007-6-29 11:37:32 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
The servlet invokes a seperate session bean instance for every invoke of the bean by the servlet.Don't worry about the thread safe.u can set no of the instance u want to have during start up of the server.
jsjsjothi at 2007-6-29 11:37:32 > top of Java-index,Other Topics,Patterns & OO Design...