Top Description Fields Constructors Methods
io.undertow.server.protocol

public final Class ParseTimeoutUpdater

extends Object
implements Runnable, CloseListener, Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable, io.undertow.server.ServerConnection.CloseListener, java.lang.Runnable
Imports
io.undertow.UndertowLogger, io.undertow.server.ServerConnection, io.undertow.util.WorkerUtils, org.xnio.IoUtils, .XnioExecutor, org.xnio.channels.ConnectedChannel, java.io.Closeable, java.util.concurrent.RejectedExecutionException, .TimeUnit

Wrapper for parse timeout.
Author
Sebastian Laskawiec
See Also
io.undertow.UndertowOptions#REQUEST_PARSE_TIMEOUT

Field Summary

Modifier and TypeField and Description
private final Runnable
private final ConnectedChannel
private volatile long
private static final int
private volatile XnioExecutor.Key
private volatile boolean
private final long
private final long

Constructor Summary

AccessConstructor and Description
public
ParseTimeoutUpdater(ConnectedChannel
Channel which will be closed in case of timeout.
channel
,
long
Timeout value. Negative value will indicate that this updated is disabled.
requestParseTimeout
,
long requestIdleTimeout)

Creates new instance of ParseTimeoutSourceConduit.

public
ParseTimeoutUpdater(ConnectedChannel
Channel which will be closed in case of timeout.
channel
,
long
Timeout value. Negative value will indicate that this updated is disabled.
requestParseTimeout
,
long requestIdleTimeout, Runnable closeTask)

Creates new instance of ParseTimeoutSourceConduit.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

public void
public void
connectionIdle()

Called when the connection goes idle

public void
failedParse()

Called when a request is received, however it is not parsed in a single read() call.

private void
handleSchedule(long timeout)

public void
requestStarted()

Cancels timeout countdown.

public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

closeTaskback to summary
private final Runnable closeTask
connectionback to summary
private final ConnectedChannel connection
expireTimeback to summary
private volatile long expireTime
FUZZ_FACTORback to summary
private static final int FUZZ_FACTOR
handleback to summary
private volatile XnioExecutor.Key handle
parsingback to summary
private volatile boolean parsing
requestIdleTimeoutback to summary
private final long requestIdleTimeout
requestParseTimeoutback to summary
private final long requestParseTimeout

Constructor Detail

ParseTimeoutUpdaterback to summary
public ParseTimeoutUpdater(ConnectedChannel channel, long requestParseTimeout, long requestIdleTimeout)

Creates new instance of ParseTimeoutSourceConduit.

Parameters
channel:ConnectedChannel

Channel which will be closed in case of timeout.

requestParseTimeout:long

Timeout value. Negative value will indicate that this updated is disabled.

ParseTimeoutUpdaterback to summary
public ParseTimeoutUpdater(ConnectedChannel channel, long requestParseTimeout, long requestIdleTimeout, Runnable closeTask)

Creates new instance of ParseTimeoutSourceConduit.

Parameters
channel:ConnectedChannel

Channel which will be closed in case of timeout.

requestParseTimeout:long

Timeout value. Negative value will indicate that this updated is disabled.

Method Detail

closeback to summary
public void close()

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

closedback to summary
public void closed(ServerConnection connection)

Implements io.undertow.server.ServerConnection.CloseListener.closed.

Annotations
@Override
connectionIdleback to summary
public void connectionIdle()

Called when the connection goes idle

failedParseback to summary
public void failedParse()

Called when a request is received, however it is not parsed in a single read() call. This starts a timer, and if the request is not parsed within this time then the connection is closed.

handleScheduleback to summary
private void handleSchedule(long timeout)
requestStartedback to summary
public void requestStarted()

Cancels timeout countdown.

Should be called after parsing is complete (to avoid closing connection during other activities).

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override