James Perkins skrev den 21-08-2008 20:06:
I'm using a TimerTask, so in the code I don't yield or sleep.

Here is what the constructor looks like.
public DirectoryMonitor(long interval) {
files_ = new HashMap();
dirs_ = new HashMap();
listeners_ = new ArrayList();

timer_ = new Timer(true);
timer_.schedule(new DirectoryMonitorNotifier(), 0, interval);

I got most of the code from some where, can't remember exactly. It might be
work re-working to implement Runnable and use Observer and Observable to
notify. I've never used TimerTask before so I don't know much about it.
The Java class libraries are truly a jungle. Could you show us the DirectoryMonitorNotifier class too?

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.