Here is what I would do if I were in tour place.

The job would be done in two parts...
Part 1.
    servlet gets the requast for calculations and
    opens new thread that does the work.
    You start the calculations and keep a reference to this object in
    some static member of some class
    (
       You can have a class with
         public static Vector CalcThreads;
       where you keep all the threads that do some calculations.
       (Of course you need to have some way to identify a Calc Job and to remove reference after some time)
    )
    when you start your Calculations you return response to user with a link that looks something like this
    http://www.address.com:port/servlet/ShowResults?CalcID
    
now goes the second part
Part 2.
    User clicks the link
    Servlet (ShowResults) finds your CalcThread using that  ID (CalcID)
    if the calculations are finished it sends back the results
    and if not you can send a message to try later and the same link again



At 06:50 1999.03.12 -0800, you wrote:
>I have a servlet that starts a long series of calculations.
>The calculations can take up to 30 minutes.
>
>This leads to 2 problems:
>1. The timeout of the server is less than 30 minutes,
>so we get a 'document contains no data'.
>2. We don't want to raise the timeout, because a user
>won't usually wait that long.
>
>We thought of the following solution:
>1. The user calls a servlet.
>2. This servlets starts a process in background that calculates
>a result and writes it to a file on the server.
>3. The user gets an immediate response with the URL of this file,
>so he can visit this URL once the calculations are finished.
>
>What is the best way to do this? A servlet calling another servlet?
>Starting a thread (but won't this thread be killed once the servlet
>has sent his response)?
>
>Is there a means to let the user know when the calculations are done
>to prevent 404 errors or having to look at an incomplete result?
>
>Thanks in advance,
>Bruno
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
           |||||
          (o)-(o)
-----oOOo----U----oOOo-----
      [EMAIL PROTECTED]
---------------------------
        (___| |___)

       Dean  Nizetic




___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to