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 <[email protected]> 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.
>
>
>
> On Thu, May 23, 2013 at 10:56 AM, Craig Ching <[email protected]>wrote:
>
>> Hi Joakim,
>>
>> Thanks for the pointer.  I would love to try webdefault, but the problem
>> is I don't know how to set it in an OSGi environment, it always seems to
>> use the one in osgi.boot.  I have an unanswered question from a couple of
>> days ago on the jetty-users forum and haven't found the answer myself yet.
>>
>> We don't embed per se, at least not using our code, we use OSGi, so we're
>> using osgi.boot.
>>
>> Cheers,
>> Craig
>>
>>
>> On Thu, May 23, 2013 at 10:50 AM, Joakim Erdfelt <[email protected]>wrote:
>>
>>> The default in code is false.
>>> The default in the distributions configuration is true.
>>>
>>> See ${jetty.home}/etc/webdefault.xml
>>> This is the usual place people configure the DefaultServlet.
>>>
>>> If you are using embedded mode Jetty, then consider using the
>>> WebAppContext.setOverrideDescriptor(String) to set your own version of the
>>> etc/webdefault.xml
>>>
>>> http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/webapp/WebAppContext.html#setOverrideDescriptor(java.lang.String)
>>>
>>>
>>> --
>>> Joakim Erdfelt <[email protected]>
>>> webtide.com <http://www.webtide.com/>
>>> Developer advice, services and support
>>> from the Jetty & CometD experts
>>> eclipse.org/jetty - cometd.org
>>>
>>>
>>> On Thu, May 23, 2013 at 8:43 AM, Craig Ching <[email protected]>wrote:
>>>
>>>> As far as I can tell, the code in that commit was fixed in Jetty 9
>>>> in 13ed1df33fa4884a and looking at M0 the code is not there and looking at
>>>> 9.0.0, the code is there.  So that bug mentioned in the release notes
>>>> (405281) was actually fixed before 9.0.0.  So there seems to be something
>>>> else wrong here.
>>>>
>>>> Question: Am I wrong in looking at DefaultServlet and how
>>>> _useFileMappedBuffer is initialized, it looks like the default is actually
>>>> false and not true as documented.
>>>>
>>>> I'll open a bug for useFileMappedBuffer not seeming to be honored in
>>>> DefaultServlet.  Any ideas on how we can workaround this in meantime?
>>>>  We're in an OSGi environment and I thought that maybe just restarting
>>>> either jetty-server, jetty-io, or osgi.boot might free up the file, but
>>>> only completely restarting the process seems to work.
>>>>
>>>>
>>>> On Thu, May 23, 2013 at 10:29 AM, Craig Ching <[email protected]>wrote:
>>>>
>>>>> This must be the one you're talking about:
>>>>>
>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=405281
>>>>>
>>>>> Going to see if I can find that commit to the jetty 9 release.
>>>>>
>>>>>
>>>>> On Thu, May 23, 2013 at 10:21 AM, Craig Ching <[email protected]>wrote:
>>>>>
>>>>>> Should have mentioned that we are on jetty 9.0.3.v20130506 ;-)
>>>>>>
>>>>>> The only bug I could find related was:
>>>>>>
>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=395885
>>>>>>
>>>>>> But that was fixed prior to 9.0.0 it seems.  I'll see if I can find
>>>>>> the bug you're talking about.
>>>>>>
>>>>>>
>>>>>> On Thu, May 23, 2013 at 10:01 AM, Jesse McConnell <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> I think we had a report on that and it was resolved in the latest
>>>>>>> jetty 9 release, 9.0.3.v20130506
>>>>>>>
>>>>>>> try that and if you still have an issue open a bug at
>>>>>>> bugs.eclipse.org under RT/Jetty
>>>>>>>
>>>>>>> jesse
>>>>>>>
>>>>>>> --
>>>>>>> jesse mcconnell
>>>>>>> [email protected]
>>>>>>>
>>>>>>>
>>>>>>> On Thu, May 23, 2013 at 9:51 AM, Craig Ching 
>>>>>>> <[email protected]>wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> Since changing to jetty 9, my windows developers are experiencing
>>>>>>>> problems with updating javascript files while jetty is running.  We use
>>>>>>>> "useFileMappedBuffers=false" in development so that on Windows they can
>>>>>>>> overwrite the javascript source and just refresh in the browser.  But 
>>>>>>>> since
>>>>>>>> moving to jetty 9, we are not able to overwrite these resources.
>>>>>>>>
>>>>>>>> Is anyone else having a problem?  Or is it a misconfiguration on my
>>>>>>>> part?  Here's our web.xml:
>>>>>>>>
>>>>>>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>>>>>>> <web-app xmlns="http://java.sun.com/xml/ns/javaee"; xmlns:xsi="
>>>>>>>> http://www.w3.org/2001/XMLSchema-instance";
>>>>>>>>     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>>>>>>>> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd";
>>>>>>>>     version="3.0">
>>>>>>>>
>>>>>>>>    <display-name>Administration Webapp</display-name>
>>>>>>>>    <servlet>
>>>>>>>>      <servlet-name>default</servlet-name>
>>>>>>>>
>>>>>>>> <servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
>>>>>>>>      <init-param>
>>>>>>>>        <param-name>useFileMappedBuffer</param-name>
>>>>>>>>        <param-value>false</param-value>
>>>>>>>>      </init-param>
>>>>>>>>      <init-param>
>>>>>>>>        <param-name>dirAllowed</param-name>
>>>>>>>>        <param-value>false</param-value>
>>>>>>>>      </init-param>
>>>>>>>>      <load-on-startup>0</load-on-startup>
>>>>>>>>    </servlet>
>>>>>>>>
>>>>>>>> </web-app>
>>>>>>>>
>>>>>>>> Note that I just flipped the webapp element from 2.5 to 3.0 without
>>>>>>>> any changes to the content, maybe I'm doing something wrong there?
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>> Craig
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> jetty-users mailing list
>>>>>>>> [email protected]
>>>>>>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> jetty-users mailing list
>>>>>>> [email protected]
>>>>>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> jetty-users mailing list
>>>> [email protected]
>>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> jetty-users mailing list
>>> [email protected]
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>
>>>
>>
>
> _______________________________________________
> jetty-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
>
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to