[
https://issues.apache.org/jira/browse/VFS-486?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sam Haldane updated VFS-486:
----------------------------
Attachment: VFS-486.diff
Diff attached.
> DefaultFileMonitor sleeps for twice the specified delay when checkPerRun > 0
> ----------------------------------------------------------------------------
>
> Key: VFS-486
> URL: https://issues.apache.org/jira/browse/VFS-486
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Reporter: Sam Haldane
> Priority: Minor
> Attachments: VFS-486.diff
>
>
> There's a bug in {{DefaultFileMonitor}} that causes the monitor thread to
> sleep twice if {{getChecksPerRun() > 0}}. {{DefaultFileMonitor.checksPerRun}}
> defaults to 1000.
> In the main loop:
> {code:java}
> for (int iterFileNames = 0; iterFileNames < fileNames.length;
> iterFileNames++)
> {
> // do some stuff
> if (getChecksPerRun() > 0)
> {
> if ((iterFileNames % getChecksPerRun()) == 0)
> {
> try
> {
> Thread.sleep(getDelay());
> }
> catch (InterruptedException e)
> {
> // Woke up.
> }
> }
> }
> // do more stuff
> }
> {code}
> and then at the end of the loop block:
> {code:java}
> try
> {
> Thread.sleep(getDelay());
> }
> catch (InterruptedException e)
> {
> continue;
> }
> {code}
> Workaround is to call {{setChecksPerRun(0)}}.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira