Hi!


> As far as I understand, there's no way to cache states across sessions
> in EJB, right? Then how can I accomplish this:
> We have some chained Java objects to be converted into EJBs, and these
> objects perform quite costly operations. But the data these operations
> return should only be temporary
> so it wouldn't really make sense to model it in the DB. For 
> the sake of
> performance, we put the data in a buffer and use a flag to 
> check whether
> the condition has changed, and only
> recalculate the whole thing if there's any change. But with EJB, I
> cann't really hold a buffer in the bean because I don't have 
> any control
> over the life cycle of the bean:-(
> Well, to rephrase my question, is there some way to retrieve 
> some cached
> state from EJB without resort to persistent storage?
> Any hint or tip will be highly appreciated and many thanks in advance!

What do you think about stateful session beans?

For example, if you take the stateful session bean, you have the
conversational state. Having the big cache you can expect that your bean
will remain in memory. At least, when the bean is to be removed from the
cache, you'll get a passivation event (ejbPassivate). And you can start your
calculations on activation (ejbActivate) or creation (ejbCreate).

Also I do not see any problem with storing buffer content in serialized form
into some database record. If you say that calculations are costly, then
storing data in DB will not be so costly, probably even less than 1% of the
total execution time. 

Reards,
Roman.

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to