Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Session Backup

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am looking to protect the session by creating a backup session. Then if the app has been inactive for the standard 30mins then a check could be made to see if the session still exists. If it does not exist, an option is given to restore the session from the backupSession.
All I need to know is if the main session (Call it 'sess') times-out at 30mins and backupsSession is set to:
backupSession.setMaxInactiveInterval(60*60*60*4); // Set to 4 hours
When the timeout occurs will backupSession still exist or is backupSession riding on the back of sess and will timeout at the 30minute mark?
Thank you in advance,
Gary
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think this would work - the servlet engine only manages one session at a time per user. You could establish a separate persistance method for an object with your custom cookies for an ID but it would not be a session.
If you store a custom object in a session you can provide for being notified when the session is about to delete the object and store it elsewhere - for instance serialize to disk.
Alternately just make the standard session timeout longer.
Bill
 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Gary Busby:
I am looking to protect the session by creating a backup session. Then if the app has been inactive for the standard 30mins then a check could be made to see if the session still exists.


Gary,
This is a strange thing to be doing. It might help if you explain the purpose of your backup session. Meanwhile, I can tell you about a related way of "protecting" sessions.
The purpose is to allow multiple (clustered) web servers to act as real-time backups for each other: If the server that has been serving a given client's session goes down, for example, you want another one of the web servers to handle incoming requests which will be automatically routed to a remaining server. Thats the purpose.
One is "session replication". In this case, if you have only two web servers, then each session on one is transmitted in real time for every method request to the other in memory. Cool, huh?
But if you have numerous web servers, they can use disk (to avoid memory over consumption). This does not even tap the power of J2EE.
Another solution involves J2EE. I'll elaborate if you're interested.
John
 
Gary Busby
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you to all who helped.
Best regards,
Gary
 
Tell me how it all turns out. Here is a tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic