[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] Jetty 9 DefaultServlet and useFileMappedBuffers
|
Since Jetty9 requires Java7, maybe it'd be a good idea to use the new try-with-resources statement more places?
On Thu, May 23, 2013 at 3:31 PM, Craig Ching
<craigching@xxxxxxxxx> wrote:
Should the FileChannel in BufferUtil.readFrom() be closed?
public static void readFrom(File file, ByteBuffer buffer) throws IOException
{
RandomAccessFile raf = new RandomAccessFile(file,"r");
FileChannel channel = raf.getChannel();
long needed=raf.length();
while (needed>0 && buffer.hasRemaining())
needed=needed-channel.read(buffer);
}
What I'm seeing is that my static resources are being served from ResourceCache.getIndirectBuffer() which doesn't even consider _useFileMappedBuffer (seems like it probably should). So it's not memory mapped files that are causing resources to be locked on Windows, it's something else. If that FileChannel needs to be closed, that would explain it. I'm going to try this on Windows now, been working on Linux just to debug since I have a development environment there.
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users