commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niall Pemberton <niall.pember...@gmail.com>
Subject Re: [IO] FilesystemMonitor responsiveness
Date Tue, 12 Oct 2010 00:13:02 GMT
On Tue, Oct 12, 2010 at 1:00 AM, Gary Gregory
<GGregory@seagullsoftware.com> wrote:
> Hi All:
>
> Is there any reason why the FilesystemMonitor.run() method is not short-circuited ASAP?
For example, by doing this:

Its more consistent - all observers get notified, rather than
(possibly) having only some that are and some not.

Also anyone can implement their own run() behaviour in their own
implementation if they require.

Niall

>    /**
>     * Run.
>     */
>    public void run() {
>        while (running) {
>            for (FilesystemObserver observer : observers) {
>                observer.checkAndNotify();
>                if (!running) {
>                   return;
>                }
>            }
>            try {
>                Thread.sleep(interval);
>            } catch (final InterruptedException ignored) {
>            }
>        }
>    }
>
> Instead of:
>
>    /**
>     * Run.
>     */
>    public void run() {
>        while (running) {
>            for (FilesystemObserver observer : observers) {
>                observer.checkAndNotify();
>            }
>            if (!running) {
>                break;
>            }
>            try {
>                Thread.sleep(interval);
>            } catch (final InterruptedException ignored) {
>            }
>        }
>    }
>
> Gary Gregory
> Senior Software Engineer
> Rocket Software
> 3340 Peachtree Road, Suite 820 . Atlanta, GA 30326 . USA
> Tel: +1.404.760.1560
> Email: ggregory@seagullsoftware.com
> Web: seagull.rocketsoftware.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message