-
1. Re: removalTimeoutInSeconds & subsequent removal?
protuhj Mar 10, 2009 9:09 PM (in response to protuhj)"Protuhj" wrote:
...It only doesn't seem to get called when the bean is supposed to be removed.
i meant this to be, "It only doesn't seem to get called when the bean is supposed to be removed when it reaches the timeout set with removalTimeoutInSeconds" -
2. Re: removalTimeoutInSeconds & subsequent removal?
protuhj Mar 11, 2009 9:05 AM (in response to protuhj)I solved my problem by adding @PreDestroy to my destroy method as well as making my objects associated with my socket transient, and marking them with @Transient
-
3. Re: removalTimeoutInSeconds & subsequent removal?
protuhj Mar 11, 2009 9:21 AM (in response to protuhj)Ok -- I am getting frustrated over this, I have marked my remove function with @Remove and @PreDestroy and @PrePassivate, idleTimeoutSeconds is 5, removalTimeoutSeconds is 10, my members are transient.
It first times out and passivates, and calls remove on the Proper SFSB. It then tries to remove the bean using @PreDestroy 5 seconds later. When I redeploy my EJB to the app server, it calls my destroy method AGAIN, like it wasn't destroyed properly in the first place.
If I don't have @PrePassivate, it will call my destroy method via the @PreDestroy annotation I guess, but since it was passivated, it is not the correct instance of the bean so it doesn't close the socket. Then when I redeploy the EJB it calls the my remove function on the proper bean. This doesn't seem to be working like it should. -
4. Re: removalTimeoutInSeconds & subsequent removal?
protuhj Mar 11, 2009 9:24 AM (in response to protuhj)If I then make my removalTimeoutSeconds less than the idleTimeoutSeconds and just have @PreDestroy and @Remove on my method, it doesn't even call my remove function until the EJB deployment is redeployed
-
5. Re: removalTimeoutInSeconds & subsequent removal?
protuhj Mar 11, 2009 9:53 AM (in response to protuhj)this is the AppServer 4.2.3.
-
6. Re: removalTimeoutInSeconds & subsequent removal?
protuhj Mar 11, 2009 11:31 AM (in response to protuhj)So I think I have a solution that works, but it seems like a hack. I have to set my idle timeout to less than the removal timeout, which is not what I wanted to do. I wanted it to just remove my bean as soon as it hit became idle.
But since when you hit removalTimeoutSeconds it doesn't actually do any cleanup of the memory (it just removes the data from the disk cache), setting the idleTimeout higher than the removalTimeout per the wiki doesn't work.
Something definitely seems broken with the way this is implemented in JBOSS AS 4.2.3, I don't know if it is any different in 5.0, I assume not.
This is the way I want it to work:
Client gets bean
bean connects the socket
client crashes (in our setup, this may happen, you never know)
bean times out (removalTimeoutSeconds not idle)
some annotated function gets called (@Remove or @PreDestroy this doesnt happen right now)
my socket is closed properly since the function was called
the other end of the socket gets the closure notice
this is what happens:
client gets bean
bean connects the socket
client crashes
bean times out (removalTimeoutSeconds)
no function of mine gets called
<nothing until...> i redeploy the EJB and then the preDestroy on the bean gets called.. -
7. Re: removalTimeoutInSeconds & subsequent removal?
mikka2010 Oct 22, 2010 7:52 AM (in response to protuhj)Hello,
I have a similar problem.
I use a stateful session bean with a removalTimeoutSeconds = 60 (for testing), but after the timeout the method annotated with @Remove is not executed.
Only the method annotated with @PreDestroy is called.
In the heap dump I can still see the session bean object in memory.
I want to use the removalTimeout for such sessions which terminate abnormal.
If the client terminates normal, it calls the method annotated with @Remove and then the method annotated with @PreDestroy.
In this scenario the session bean object is not present in the memory anymore.
I use the application server jboss 4.2.3_GA.
Why is the remove method not called in case of a timeout and why does the object remain in memory?
Kind regards
Huber