Hi,
it will not hold the state of a SFSB (stateful session bean) forever.
After some period of time sessions expire and are removed by the
container. This is similiar to session state in a web container with
HTTPSession. As long as the session is active it will be maintained but
after a while of no activity it is removed. Generally, it is good to
explicitly remove session state if an application knows that a session
has ended since this frees up resources earlier, but since you cant
count on that always happenning the container will remove the state of
expired sessions. That is the nature of session state, it is alive only
for the duration of the session, and that duration is usually time
based. One reason for that design is that it handles the use case of a
client starting a conversational session, making a few requests, and
then just stopping in the middle of the conversation(maybe they stop
shopping after putting a few items in the shopping cart, and you dont
always expect the site to save your shopping cart contents). This is a
common case so server designed a mechanism to handle this, which is
session state and timing out of sessions.
If you want state to last forever, you should push it to the DB.
If you are looking for some guidelines on stroing session state you
could check out
http://java.sun.com/blueprints/qanda/app_arch/index.html
hope that helps,
Sean
Arzamasov Alexey wrote:
>On Thursday 26 February 2004 09:41, Sean Brydon wrote:
>
>
>
>>The EJB container maintains controls the lifecycle of session beans, so
>>you do not need to call remove. It will create them and destroy them as
>>needed. This is a nice feature of EJB containers since you are free to
>>focus on the application business logic and let the conainer manage the
>>object lifecycle.
>>
>>On entity beans you would call remove if you want to remove some data
>>from the database.
>>
>>
>
>I guess that one should call remove() on statefull session bean to signal to
>container that this bean can be removed and do not need to be passivated.
>I guess that not calling remove() will cause container to hold my statefull
>session bean forever.
>Is it wrong?
>
>====================================================================
>Companion Site: http://www.corej2eepatterns.com
>J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
>List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
>Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
>
>
====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)