[jetty-dev] [jira] (JETTY-1513) DirectNIOBuffer does not release the file it is constructed from, consequently one cannot delete the file.

"Jan Bartel (JIRA)" <[email protected]>
Newsgroups gmane.comp.java.jetty.general
Message-ID <217372614.75377.1336070882966.JavaMail.j2ee-jira@codehaus01.managed.contegix.com>
    [ https://jira.codehaus.org/browse/JETTY-1513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=297816#comment-297816 ] 

Jan Bartel commented on JETTY-1513:
-----------------------------------

Warren,

Did you actually read the sun bug I pasted the link for??? In particular the evaluation:
{quote}
We cannot fix this.  Windows does not allow a mapped file to be deleted.  This
problem should be ameliorated somewhat once we fix our garbage collectors to
deallocate direct buffers more promptly (see 4469299), but otherwise there's
nothing we can do about this.
{quote}

Furthermore I draw your attention to the javadoc for the FileChannel class:
{quote}
The buffer and the mapping that it represents will remain valid until the buffer itself is garbage-collected.
A mapping, once established, is not dependent upon the file channel that was used to create it. Closing the channel, in particular, has no effect upon the validity of the mapping. 
{quote}

If you would like to submit a workaround for the DirectNIOBuffer class, taking into account both of the above, we will take a look at it. I would also appreciate it if you would adopt a less aggressive tone to your posts.
                
> DirectNIOBuffer does not release the file it is constructed from, consequently one cannot delete the file.
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: JETTY-1513
>                 URL: https://jira.codehaus.org/browse/JETTY-1513
>             Project: Jetty
>          Issue Type: Bug
>          Components: NIO
>            Reporter: Warren Goldman
>            Assignee: Jan Bartel
>
> 		Path file = Paths.get("C:/Temp/my.test");
> 		DirectNIOBuffer buffer = new DirectNIOBuffer(file.toFile());
> 		Files.deleteIfExists(file);
> 		// the Files.deleteIfExists throws the following exception
> //		java.nio.file.FileSystemException: C:\Temp\my.test: The process cannot access the file because it is being used by another process.
> //		at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
> //		at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
> //		at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
> //		at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:268)
> //		at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
> //		at java.nio.file.Files.deleteIfExists(Files.java:1110)
> //		at test.MyTest.run(MyTest.java:28)
> //		at test.MyTest.main(MyTest.java:41)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.