Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Question regarding Continuation documentation

Hi,

yes I can setup the timeout later, but the documentation also states that suspend must be called before handing over the continuation to background/event worker. Of course I can start the work and try to set the Continuation later, but this would require some kind of carefull syncronization ...

I haven't tried yet, but is it then possible to re-suspend the Continuation after it has been resumed?

Am 11.11.2014 18:55, schrieb Simone Bordet:
Hi,

On Tue, Nov 11, 2014 at 10:37 AM, Christoph Läubrich
<laeubi@xxxxxxxxxxxxxx>  wrote:
Hi,

the documentation here suggest:

'The timeout should be set before the suspend'
https://wiki.eclipse.org/Jetty/Feature/Continuations#Suspending_a_Request

Is there any way to change the timeout value AFTER a call to suspend? In my
case I set up all the continuation timout stuff and suspend it, then submit
ot a background worker. If the worker can't process the request I want to
set a (shorter) timeout to throttle the client before the next request.
Can you set the timeout *after* you know the worker will be able to
process the request ?
if (submit(work))
     timeout = 30000;
else
     timeout = 1000;
ctx = request.startAsync();
ctx.setTimeout(timeout);

Alternatively, you can startAsync(), submit and return, and the task
can dispatch (perhaps to a different URI, or differentiating using a
request attribute) where you call startAsync() again with the throttle
timeout.




Back to the top