447472 Clear async context timeout on async static content

This commit is contained in:
Greg Wilkins 2014-11-20 11:41:11 +11:00
parent a0f6d07847
commit 46a5ef861d
4 changed files with 8 additions and 5 deletions

View File

@ -40,7 +40,7 @@ public class HttpChannelState
{ {
private static final Logger LOG = Log.getLogger(HttpChannelState.class); private static final Logger LOG = Log.getLogger(HttpChannelState.class);
private final static long DEFAULT_TIMEOUT=30000L; private final static long DEFAULT_TIMEOUT=Long.getLong("org.eclipse.jetty.server.HttpChannelState.DEFAULT_TIMEOUT",30000L);
/** The dispatched state of the HttpChannel, used to control the overall livecycle /** The dispatched state of the HttpChannel, used to control the overall livecycle
*/ */

View File

@ -58,9 +58,9 @@ public class ResourceCache
private final boolean _etagSupported; private final boolean _etagSupported;
private final boolean _useFileMappedBuffer; private final boolean _useFileMappedBuffer;
private int _maxCachedFileSize =4*1024*1024; private int _maxCachedFileSize =128*1024*1024;
private int _maxCachedFiles=2048; private int _maxCachedFiles=2048;
private int _maxCacheSize =32*1024*1024; private int _maxCacheSize =256*1024*1024;
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Constructor. /** Constructor.
@ -297,7 +297,7 @@ public class ResourceCache
{ {
try try
{ {
if (_useFileMappedBuffer && resource.getFile()!=null) if (_useFileMappedBuffer && resource.getFile()!=null && resource.length()<Integer.MAX_VALUE)
return BufferUtil.toMappedBuffer(resource.getFile()); return BufferUtil.toMappedBuffer(resource.getFile());
return BufferUtil.toBuffer(resource,true); return BufferUtil.toBuffer(resource,true);

View File

@ -72,7 +72,7 @@ public class ResourceHandler extends HandlerWrapper
String _cacheControl; String _cacheControl;
boolean _directory; boolean _directory;
boolean _etags; boolean _etags;
int _minMemoryMappedContentLength=-1; int _minMemoryMappedContentLength=1024;
int _minAsyncContentLength=0; int _minAsyncContentLength=0;
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
@ -522,6 +522,7 @@ public class ResourceHandler extends HandlerWrapper
resource.length()>=min_async_size) resource.length()>=min_async_size)
{ {
final AsyncContext async = request.startAsync(); final AsyncContext async = request.startAsync();
async.setTimeout(0);
Callback callback = new Callback() Callback callback = new Callback()
{ {
@Override @Override
@ -542,6 +543,7 @@ public class ResourceHandler extends HandlerWrapper
// Can we use a memory mapped file? // Can we use a memory mapped file?
if (_minMemoryMappedContentLength>0 && if (_minMemoryMappedContentLength>0 &&
resource.length()>_minMemoryMappedContentLength && resource.length()>_minMemoryMappedContentLength &&
resource.length()<Integer.MAX_VALUE &&
resource instanceof FileResource) resource instanceof FileResource)
{ {
ByteBuffer buffer = BufferUtil.toMappedBuffer(resource.getFile()); ByteBuffer buffer = BufferUtil.toMappedBuffer(resource.getFile());

View File

@ -920,6 +920,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
if (request.isAsyncSupported()) if (request.isAsyncSupported())
{ {
final AsyncContext context = request.startAsync(); final AsyncContext context = request.startAsync();
context.setTimeout(0);
((HttpOutput)out).sendContent(content,new Callback() ((HttpOutput)out).sendContent(content,new Callback()
{ {