Hi All,
I am using a4j:push in my application.
My session scoped managed bean has the following:
public class MyBean{
public MyBean(){
DiscoveryTask.addListener(this);
}
public void addCommandListener(EventListener listener) {
synchronized (listener)
{
commandEventListener = (PushEventListener) listener;
}
}
public void push() { //DiscoveryTask calls push
if (commandEventListener != null)
{
loadData();
synchronized (commandEventListener)
{
commandEventListener.onEvent(new EventObject(this));
}
}
}
private PushEventListener commandEventListener;
....
}
When the session times out or when then user closes the browser, I want to remove the listener(MyBean instance) from DiscoveryTask. How do I detect these events and remove the listener? I don't want the DiscoveryTask to hold on to all the session beans that are not in use.
Thanks,
Bindu
if you are using stateful ejb, then use predestroy or remove method to do these types of cleaning actions.
or if you are using jee6, use timeout annotations out of box.