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

Discussion in 'Java' started by Steve, Jan 6, 2009.

  1. Steve

    Steve Guest

    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!
     
    Steve, Jan 6, 2009
    #1
    1. Advertising

  2. Re: control the session timeout in web container if database queryisstill running

    On Tue, 06 Jan 2009 12:55:20 -0800, 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?
    >
    > <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
     
    Arved Sandstrom, Jan 7, 2009
    #2
    1. Advertising

  3. Steve

    Arne Vajhøj Guest

    Re: control the session timeout in web container if database queryis still running

    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?
    >
    > <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
     
    Arne Vajhøj, Jan 12, 2009
    #3
  4. Steve

    Wojtek Guest

    Re: control the session timeout in web container if database query is still running

    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.

    --
    Wojtek :)
     
    Wojtek, Jan 12, 2009
    #4
  5. Steve

    Arne Vajhøj Guest

    Re: control the session timeout in web container if database queryis still running

    Wojtek wrote:
    > 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.


    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
     
    Arne Vajhøj, Jan 12, 2009
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Do
    Replies:
    2
    Views:
    6,432
  2. bruce barker

    Re: ASPX Page Timeout - Session Timeout

    bruce barker, Jul 20, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    11,145
    ASP.Confused
    Jul 20, 2004
  3. =?Utf-8?B?Q3JhaWc=?=

    formsauthentication timeout & session timeout

    =?Utf-8?B?Q3JhaWc=?=, Aug 10, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,693
    =?Utf-8?B?RU5JWklO?= .enizin.net>
    Aug 10, 2005
  4. =?Utf-8?B?Um9iSEs=?=
    Replies:
    4
    Views:
    5,392
    =?Utf-8?B?Um9iSEs=?=
    Apr 11, 2007
  5. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,334
    Brian Candler
    Oct 6, 2004
Loading...

Share This Page