views:

80

answers:

1

I have a jetty server which is configured to expire requests after 30 seconds, this is the configuration line in the xml config file:

<Set name="maxIdleTime">30000</Set>

There are two kinds of requests that are accepted by this server: requests which have to be served in real time and requests that come from batch scripts that can take their time to be answered.

One request in particular is expected to take up to some minutes. Now I would like to allow this request to execute in full without timing out, while keeping expiration time for "normal" real time requests low, in order to avoid potential congestions.

My guess is that I would have to do something like this:

public class MyServlet extends HttpServlet {

    ...

    public void doGet(HttpServletRequest pRequest, HttpServletResponse pResponse)
        throws IOException, ServletException {

        if (pRequest is of the type allowed to be slow) {
            set max idle time for this request very high (or infinite)
        }

        server.execute(pRequest, pResponse);
    }


}

I'm using jetty 6.1.2rc4

+1  A: 

The maxIdleTime parameter doesn't configure the time that a request is allowed to take. The value is used to remove idle threads from the thread pool when Jetty decides to shrink the pool. See the javadoc for QueuedThreadPool#setMaxIdleTime().

If requests are timing out, it is probably due to the socket timeout parameter on one or both sides.

Kevin
Thanks, I misunderstood that parameter. Now I'll look out for socket problems
Silvio Donnini