> -----Original Message-----
> From: Gary Gregory [mailto:[email protected]]
> Sent: Monday, October 11, 2010 17:00
> To: Commons Developers List
> Subject: [POOL] FilesystemMonitor responsiveness
>
> 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) {
> }
> }
> }
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
encountered 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 you
say "stop" and the object stops, now. :)
Gary
>
> 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: [email protected]
> Web: seagull.rocketsoftware.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]