We are trying to remove stateful EJB instances when the client accessing the stateful EJB dies abruptly. We do not want to rely on the timeout feature.
Let us say that we have a client that creates a stateful session bean and dies abruptly.
Is there any way of determining, from the Weblogic server by inspecting the Stateful Bean, if the client is dead?
To the best of my knowledge, there is no way for the server to check the status of the client. The EJB standard relies on the client to inform the server when it is done working with a Stateful EJB (by using the ejbRemove() method).
You could set up some sort of client-callback using RMI to ping the client periodically and determine if it is still alive, but that is almost certainly more trouble than it is worth.
Unfortunately no there is no way of checking the stateful bean's interaction with the client from within the container. To my knowledge, that would violate the EJB spec as it could introduce security issues. However, in your client, depending upon what type of client it is, you could leverage the Runtime shutdown hooks to remove the stateful instance upon closing. It gets called even if the client is crashing (unless it is something like it is coring or is killed with no SIGHUP). Anyway, hope you find this helpful.
Thanks for your reply. We would like to remove the stateful session beans even if the client application is killed or is coring and this eliminates the use of shutdown hooks.
Ok, a different question: We are using Weblogic7.0.
Is there any way of determining when and which client disconnects from the server?
I know that weblogic provides the list of clients that are connected to the server/the processes with which the server is communicating with. This is done thru the use of MBeans (ServerRuntimeMBean). Is there any kind of notification that is sent out when a client disconnects?