Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with HttpSessionBindingListener

843842Sep 24 2009
Hi

I have a problem with HttpSessionBindingListener.

The sesion timeout in web.xml is 10 min.
I open sesion 1 at 10:00 am
I open sesion 2 at 10:05 am
The valueUnbound method is called twice at 10:15 am

The problem is that the valueUnbound is fired only when the last sesion on the site gets timeout. If the example worked well:
The valueUnbound would called would be fired at 10:10 am (sesion 1)
The valueUnbound would called would be fired at 10:15 am (sesion 2)

The example code is very easy:

public class ususs extends java.lang.Object implements HttpSessionBindingListener
{
private String userName;
public ususs(String userName) {
this.userName=userName;
}



public void valueBound(HttpSessionBindingEvent event)
{
userName="kk";

}


public void valueUnbound(HttpSessionBindingEvent event)
{
userName="";
}



... And request.getSession().setAttribute("oUsuss", new ususs("myuser")); when the user logins


Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 22 2009
Added on Sep 24 2009
0 comments
120 views