public class JerseyRequestTimeoutHandler extends Object
ContainerResponseWriter.suspend(long, TimeUnit, ContainerResponseWriter.TimeoutHandler)
and ContainerResponseWriter.setSuspendTimeout(long, TimeUnit) handler that can be used in
ContainerResponseWriter implementations instead of the underlying infrastructure.| Constructor and Description |
|---|
JerseyRequestTimeoutHandler(ContainerResponseWriter containerResponseWriter,
ScheduledExecutorService timeoutTaskExecutor)
Create request timeout handler for the giver
response writer. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Cancel the suspended task.
|
void |
setSuspendTimeout(long timeOut,
TimeUnit unit)
Set the suspend timeout.
|
boolean |
suspend(long timeOut,
TimeUnit unit,
ContainerResponseWriter.TimeoutHandler handler)
Suspend the request/response processing.
|
public JerseyRequestTimeoutHandler(ContainerResponseWriter containerResponseWriter, ScheduledExecutorService timeoutTaskExecutor)
response writer.containerResponseWriter - response writer to create request timeout handler for.timeoutTaskExecutor - Jersey runtime executor used for background execution of timeout
handling tasks.public boolean suspend(long timeOut,
TimeUnit unit,
ContainerResponseWriter.TimeoutHandler handler)
timeOut - time-out value. Value less or equal to 0, indicates that
the processing is suspended indefinitely.unit - time-out time unit.handler - time-out handler to process a time-out event if it occurs.true if the suspend operation completed successfully, false otherwise.ContainerResponseWriter.suspend(long, TimeUnit, ContainerResponseWriter.TimeoutHandler)public void setSuspendTimeout(long timeOut,
TimeUnit unit)
throws IllegalStateException
timeOut - time-out value. Value less or equal to 0, indicates that
the processing is suspended indefinitely.unit - time-out time unit.IllegalStateException - in case the response writer has not been suspended yet.ContainerResponseWriter.setSuspendTimeout(long, TimeUnit)public void close()
Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.