struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikolaus Rumm" <nikolaus.r...@mail.kephera.com>
Subject EJB reference caching in actions
Date Tue, 01 May 2001 19:58:09 GMT
Hello,

for maintainability reasons I would like to refacture my action classes'
perform()-methods. Since I use stateless session beans for the complete
business logic the code in the perform()-methods looks pretty much the same:

// lookup for the ssb home interface
// create a ssb
// call some business function

The first step and possibly the second one could be eliminated by caching
the home interface and eventually caching the stateless session bean.

So my questions are:
1) Caching the home interfaces should not be a problem. But where should I
put these ? As attributes in the current session ? In a singleton object
that caches them ? Or even in the controller servlet (very bad idea) or the
action class (bad too) ? What about multithreading ?

2) Caching the stateless session beans is even more complicated. If I put
them in session scope then it is likely that the client will keep a
reference to a heavyweight server object throughout its lifecycle. The ejb
container normally has a pool of these but I don't think that the session
scope approach will scale well. So I put them in application scope ? Or make
a singleton object that caches these. Multithreading ?

I think that these are standard problems that have already been solved by
someone. So if anyone has an idea I would much appreciate any answer.

Regards

Nikolaus Rumm


Mime
View raw message