Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

setMaxInactiveInterval(Int i) does not work?  RSS feed

 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using WebSphere. The default MaxInactiveInterval seems to be 1800 seconds (verified using session.getMaxInactiveInterval()).
I use setMaxInactiveInterval(36000) to set it to 10 hours. Then session.getMaxInactiveInterval() does return a value of 36000. However 10 to 15 minutes later I get a new session object and session.getMaxInactiveInterval() returns a value of 1800! The browser window never changed.
What’s going on?
Thanks.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setMaxInactiveInterval is an instance method of HttpSession - when you get a new session you get the default for the server.
Bill
 
Michael Zalewski
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which version of WebSphere are you using? I think one of the versions in 3.5 had a bug where this would happen (i.e., it ignored the value you set with HttpSession.setMaxInactiveInterval().
Also, in WebSphere you can set the inactive interval to be something different than the default 30 minutes. Start the WebSphere Admin console, select the Web Application, then select the 'Advanced' tab. Halfway down the page, you will find a 'Session Timeout' property. You can set a specific value here, then tune it without having to change your code.
Final thought. Make sure you are not calling HttpSession.invalidate(). That would clear your session and also the inactive interval you might have previously set.
 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
My WAS is 3.5.4 on AS400.
I will try using console.
Bruce
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!