/**
+ * Default timeout for asynchronous requests (ms).
+ */
+ protected long asyncTimeout = 10000;
+
+
+ /**
* The "enable DNS lookups" flag for this Connector.
*/
protected boolean enableLookups = false;
/**
+ * Return the default timeout for async requests in ms.
+ */
+ public long getAsyncTimeout() {
+
+ return asyncTimeout;
+
+ }
+
+
+ /**
+ * Set the default timeout for async requests.
+ *
+ * @param allowTrace The new timeout in ms.
+ */
+ public void setAsyncTimeout(long asyncTimeout) {
+
+ this.asyncTimeout= asyncTimeout;
+ setProperty("asyncTimeout", String.valueOf(asyncTimeout));
+
+ }
+
+
+ /**
* Return the "enable DNS lookups" flag.
*/
public boolean getEnableLookups() {
//TODO SERVLET3 - async - need to retrieve the ServletContext here
//or just the webapp classloader associated with to do
//run with start(Runnable)
- asyncContext.setHasOriginalRequestAndResponse(request==getRequest() && response==getResponse().getResponse());
+ asyncContext.setHasOriginalRequestAndResponse(request==getRequest() &&
+ response==getResponse().getResponse());
+
+ asyncContext.setTimeout(getConnector().getAsyncTimeout());
+
return asyncContext;
}
// Start acceptor threads
for (int i = 0; i < acceptorThreadCount; i++) {
- Thread acceptorThread = new Thread(new Acceptor(), getName() + "-Acceptor-" + i);
+ Thread acceptorThread = new Thread(new Acceptor(),
+ getName() + "-Acceptor-" + i);
acceptorThread.setPriority(threadPriority);
acceptorThread.setDaemon(getDaemon());
acceptorThread.start();
}
+
+ // Start async timeout thread
+ Thread timeoutThread = new Thread(new AsyncTimeout(),
+ getName() + "-AsyncTimeout");
+ timeoutThread.setPriority(threadPriority);
+ timeoutThread.setDaemon(true);
+ timeoutThread.start();
}
}
replaced, ensure that the new Set-Cookie header overwrites the old
Set-Cookie header. (markt)
</fix>
+ <fix>
+ Create a thread to trigger asynchronous timeouts when using the BIO
+ connector, change the default timeout to 10s (was infinite) and make the
+ default timeout configurable using the <code>asyncTimeout</code>
+ attribute on the connector. (pero/markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
HTTP method. If not specified, this attribute is set to false.</p>
</attribute>
+ <attribute name="asyncTimeout" required="false">
+ <p>The default timeout for asynchronous requests in milliseconds. If not
+ specified, this attribute is set to 10000 (10 seconds).</p>
+ </attribute>
+
<attribute name="enableLookups" required="false">
<p>Set to <code>true</code> if you want calls to
<code>request.getRemoteHost()</code> to perform DNS lookups in
HTTP method. If not specified, this attribute is set to false.</p>
</attribute>
+ <attribute name="asyncTimeout" required="false">
+ <p>The default timeout for asynchronous requests in milliseconds. If not
+ specified, this attribute is set to 10000 (10 seconds).</p>
+ </attribute>
+
<attribute name="enableLookups" required="false">
<p>Set to <code>true</code> if you want calls to
<code>request.getRemoteHost()</code> to perform DNS lookups in