control the session timeout in web container if database query isstill running

S

Steve

The web application times out at the end of 30 minutes inactivity.
However, if the
database query runs more than 30 minutes/or hangs, the web application
still times
out at the end of 30 minutes. I think the web container has no idea
the
database query is still running on the database side. My question is
what is the
best approach to control the session timeout in the web container if
the database
is processing the query?

<session-config>
<session-timeout>30</session-timeout>
</session-config>

thanks a lot!
 
A

Arved Sandstrom

The web application times out at the end of 30 minutes inactivity.
However, if the
database query runs more than 30 minutes/or hangs, the web application
still times
out at the end of 30 minutes. I think the web container has no idea the
database query is still running on the database side. My question is
what is the
best approach to control the session timeout in the web container if the
database
is processing the query?

<session-config>
<session-timeout>30</session-timeout>
</session-config>

thanks a lot!

I guess one approach would be to setMaxInactiveInterval() on the session
in question, the one that has the seriously long query. If nothing else,
set it to unlimited. After all, when the session is done you can
invalidate it.

If not doing this, you might want to consider having a MDB initiate the
query, and receive the results. You'll have to have some mechanism in
case the session does timeout, so that when a user/service logs back in,
in search of their data, they can retrieve the information they need to
look up the data.

Just some thoughts.

AHS
 
A

Arne Vajhøj

Steve said:
The web application times out at the end of 30 minutes inactivity.
However, if the
database query runs more than 30 minutes/or hangs, the web application
still times
out at the end of 30 minutes. I think the web container has no idea
the
database query is still running on the database side. My question is
what is the
best approach to control the session timeout in the web container if
the database
is processing the query?

<session-config>
<session-timeout>30</session-timeout>
</session-config>

30 minutes ?

I don't think you should expect your users to wait 30 minutes
in a web app.

Stuff the task in a queue, have an MDB process it and email
the user back when it is done.

Arne
 
W

Wojtek

Steve wrote :
The web application times out at the end of 30 minutes inactivity.
However, if the
database query runs more than 30 minutes/or hangs, the web application
still times
out at the end of 30 minutes. I think the web container has no idea
the
database query is still running on the database side. My question is
what is the
best approach to control the session timeout in the web container if
the database
is processing the query?

30 minutes for a query? Yikes!

Kick off a thread to do the database query, then return to the user
with a status page and a message that the query is running. Set the
page refresh to a minute or so. The servlet needs check to see if a
data base query is running for that user, and if so check to see if the
query is finished. If not, increment some sort of counter and
re-display the status page.
 
A

Arne Vajhøj

Wojtek said:
Steve wrote :

30 minutes for a query? Yikes!

Kick off a thread to do the database query, then return to the user with
a status page and a message that the query is running. Set the page
refresh to a minute or so. The servlet needs check to see if a data base
query is running for that user, and if so check to see if the query is
finished. If not, increment some sort of counter and re-display the
status page.

If a message queue and a MDB is an option, then it is better than
starting threads in the app code - it is not mandatory in web container
as in EJB container, but I will still consider it best practice to
leave the thread management to the container in a web container.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top