Originally posted by Randall Twede:
yes, but that wont work if the person closes the browser before they get to that line of code. I am wondering what kind of problem it can cause if you dont do anything about it?
The problem is that, I typically store some objects in the HttpSession and would like to quickly *null* those objects when the session is invalidated.
public MyObject implements HttpSessionBindingListener {
private Map map1,map2,map3;
private List list1,list2;
public MyObject() {
map1 = new HashMap();
map2 = new HashMap();
list1 = new ArrayList();
list2 = new ArrayList();
}
//Method 1
public void valueBound(HttpSessionBindingEvent eve) {
}
//Method 2
public void valueUnBound(HttpSessionBindingEvent eve) {
list1 = null;
list2 = null;
map1 = null;
map2 = null;
map3 = null;
}
}
Method 2 gets called when the session is invalidated. Session is invalidated if the client remains inactive for (say 30 mins). Closing the browser does not allow the container to call method2
immediatly nd it gets called only after 30 mins of inactivity thus holding up unused memory in the list1,list2, map1,map2,map3
objects..
I need a way to signal the conatiner to call method2 as soon as the browser is closed.
Method