public class TimeoutAction
extends java.lang.Object
In the adapter configuration file this class is aliased as jetty-http-timeout-action which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
TimeoutAction() |
TimeoutAction(TimeInterval ti) |
TimeoutAction(TimeInterval ti,
HttpStatusProvider.HttpStatus s) |
Modifier and Type | Method and Description |
---|---|
void |
checkTimeout(JettyConsumerMonitor monitor) |
TimeInterval |
getMaxWaitTime() |
HttpStatusProvider.HttpStatus |
getStatus() |
void |
handleTimeout(javax.servlet.http.HttpServletResponse response) |
void |
setMaxWaitTime(TimeInterval t)
Set the max wait time for an individual worker in a workflow to finish.
|
void |
setStatus(HttpStatusProvider.HttpStatus s)
Set the HTTP status code to be returned to the client.
|
public TimeoutAction()
public TimeoutAction(TimeInterval ti)
public TimeoutAction(TimeInterval ti, HttpStatusProvider.HttpStatus s)
public TimeInterval getMaxWaitTime()
public void setMaxWaitTime(TimeInterval t)
This setting only has an impact if the consumer is the entry point for a PoolingWorkflow
instance. In
the event that the wait time is exceeded, then the internal HttpServlet
instance commits the
response in its current state and returns control back to the Jetty engine.
t
- the maxWaitTime to set (default 10 minutes)public HttpStatusProvider.HttpStatus getStatus()
public void setStatus(HttpStatusProvider.HttpStatus s)
By default we use 202 Accepted
which seems to fit the semantics of the behaviour; the workflow is just taking a long
time (it has not yet failed). The request has been accepted for processing, but the processing has not been completed. The
request might or might not eventually be acted upon, as it might be disallowed when processing actually takes places.
You can choose something different here; a sensible option might be 500
or 503
if you want to indicate that
there is no chance of it succeeding after the timeout has been exceeded.
s
- the status, default is HttpStatus#ACCEPTED_202
public void handleTimeout(javax.servlet.http.HttpServletResponse response) throws java.io.IOException
java.io.IOException
public void checkTimeout(JettyConsumerMonitor monitor) throws java.util.concurrent.TimeoutException
java.util.concurrent.TimeoutException