• Post Reply Bookmark Topic Watch Topic
  • New Topic

As a session expires  RSS feed

 
sinasi susam
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I want to know when a session object is removed from application server.So that i want to do some operations with the object that it stores
(such as storing unfinished operation datas to database,or delete etc..).

How can i know when a jsp-servlet container removed session?

thanks.
[ October 24, 2005: Message edited by: sinasi susam ]
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the javax.servlet.http.HttpSessionListener interface.

Sun has a Tech Tip on the subject.
[ October 24, 2005: Message edited by: Scott Johnson ]
 
sinasi susam
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you scott!

I have another question,now i have a db procedure which is working very long timed("long" i mean "24 hours" for example.its used for creating a kind of report of a year).

As you can figure it ,session expires in a few minutes as its declared in configuration files of Tomcat's conf directory.

If the db operation is unfinished then i want to make the timeout parameter longer or listen the dropped session with listener and rebind it to server.So that the user can go its own way after db finished its job.How can i ensure that?Any advice?
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keeping a session alive for 24 hours probably isn't a good idea. That would use server resources unnecessarily. Also, what happens if the app server goes down or the user closes the browser? The session would be lost and so might the report results.

You should consider submitting the report asynchronously. Then you can process it in the background and you could throttle the queries if necessary.

The user could be notified via a status screen, email and/or text message that the report is complete.

Or, if you know all of the report parameters, you could pre-run the report and have it ready when the user asks for it.

If you haven't already, you might consider reviewing the execution plan for the stored procedure to see if there's anything that can be done to speed it up. An index or a summary table might help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!