commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Olofsson (JIRA)" <>
Subject [jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows
Date Wed, 05 Mar 2014 11:03:43 GMT


Robert Olofsson commented on IO-269:

I came across this issue and noticed an inefficiency in the code of the run method.

With the reOpen flag set a new RandomAccessFile is always created at the end of the main while
loop in the run method:

                if (getRun() && reOpen) {
                    reader = new RandomAccessFile(file, RAF_MODE);

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

If the reOpen flag is set a new RandomAccessFile should only be created when the length of
the file or the last modification date indicate that the file needs to be read. 

> Tailer locks file from deletion/rename on Windows
> -------------------------------------------------
>                 Key: IO-269
>                 URL:
>             Project: Commons IO
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 2.4
>         Attachments: IO-269-v2.patch, IO-269-v3.patch, IO-269.patch,
> 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

View raw message