commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows
Date Wed, 05 Mar 2014 14:49:44 GMT

    [ https://issues.apache.org/jira/browse/IO-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13920904#comment-13920904
] 

Sebb commented on IO-269:
-------------------------

bq. This is unnecessary and contributes to unnecessary file locking on Windows.

On the contrary, it is an essential part of unlocking the file on Windows when possible.
The full code is as follows:

{code}
if (reOpen) {
    IOUtils.closeQuietly(reader);
}
Thread.sleep(delayMillis);
if (getRun() && reOpen) {
    reader = new RandomAccessFile(file, RAF_MODE);
    reader.seek(position);
}
{code}

Notice that the file is closed - and therefore unlocked - during the sleep if reOpen is true.
If reOpen is false, the file remains locked by Windows for the duration of the Tailer thread.

> Tailer locks file from deletion/rename on Windows
> -------------------------------------------------
>
>                 Key: IO-269
>                 URL: https://issues.apache.org/jira/browse/IO-269
>             Project: Commons IO
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 2.4
>
>         Attachments: IO-269-v2.patch, IO-269-v3.patch, IO-269.patch, ReOpen.java
>
>
> The Tailer code works on Windows, except that it locks the file against deletion or rename.
> The test code fails to detect this, because it fails to check if the file deletion succeeds.
> This seems to be a Windows OS issue.
> A possible solution might be to keep closing and re-opening the file.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message