Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 36181 invoked from network); 12 Oct 2010 00:09:01 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 Oct 2010 00:09:01 -0000 Received: (qmail 73557 invoked by uid 500); 12 Oct 2010 00:09:01 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 73440 invoked by uid 500); 12 Oct 2010 00:09:01 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 73431 invoked by uid 99); 12 Oct 2010 00:09:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Oct 2010 00:09:00 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of GGregory@seagullsoftware.com designates 216.82.250.3 as permitted sender) Received: from [216.82.250.3] (HELO mail75.messagelabs.com) (216.82.250.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Oct 2010 00:08:55 +0000 X-VirusChecked: Checked X-Env-Sender: GGregory@seagullsoftware.com X-Msg-Ref: server-9.tower-75.messagelabs.com!1286842112!31537740!1 X-StarScan-Version: 6.2.4; banners=-,-,- X-Originating-IP: [137.134.240.188] Received: (qmail 8166 invoked from network); 12 Oct 2010 00:08:33 -0000 Received: from unknown (HELO postal.rocketsoftware.com) (137.134.240.188) by server-9.tower-75.messagelabs.com with AES128-SHA encrypted SMTP; 12 Oct 2010 00:08:33 -0000 Received: from NWT-S-MBX1.rocketsoftware.com ([fe80::34fc:6d7f:6837:62b]) by nwt-s-cas2.rocketsoftware.com ([::1]) with mapi id 14.01.0218.012; Mon, 11 Oct 2010 20:08:21 -0400 From: Gary Gregory To: Commons Developers List Subject: [IO] FilesystemMonitor responsiveness Thread-Topic: [IO] FilesystemMonitor responsiveness Thread-Index: AQHLaaGUqciJn33R5kGjx42FM8MHlA== Date: Tue, 12 Oct 2010 00:08:21 +0000 Message-ID: <02AA127CD8DCDE48BC7D2DFB6C87083A07D839E1@nwt-s-mbx1.rocketsoftware.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.204.68] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Hi All: Is there any reason why the FilesystemMonitor.run() method is not short- circuited ASAP? For example, by doing this: /** * 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) { } } } And since I am in the querying and suggesting mood... what about replacing = the running ivar with an AtomicBoolean that is passed into checkAndNotify (= and used by checkAndNotify) which would allow the run method to really stop= ASAP. I am working in a very large system now (not related to IO) where we've enc= ountered several issues related to shutting down resources where we do not = know when/if they really shutdown. Difficult to test. I just like it when y= ou say "stop" and the object stops, now. :) 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