Don't set removalTimeoutSeconds, use idleTimeoutSeconds instead. See
http://www.jboss.org/community/wiki/HowdothetimeoutsworkwithEJB3StatefulB... This way
unused beans are passivated and thus don't remain in memory. You can also set
removalTimeoutSeconds to a large value, such as 8 hours. That way if the client really
went away, the bean will be removed from the passivation storage are after a while.
Creating a new client thread might work, but you have to be careful. First, the thread
must not lookup the EJB itself - you will end up with a new EJB, not with the one that you
want to keep alive. Therefore, you must pass the bean's proxy to the thread. Second, I
recommend creating a separate method on the EJB that does nothing - the primary purpose of
this method is for the extra thread to occasionally call it. This should guarantee that
the state of the bean does not change inadvertently.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4231381#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...