java.util.TimerTask

Jeff Sturm jsturm@one-point.com
Thu Jun 19 14:46:00 GMT 2003


On 2003年6月19日, Erik Poupaert wrote:
> The only apparent difference between natObject's and natThread's
> implementations seem to be that natThread wraps its goodies in a mutex?
> I wouldn't like to jumpt to conclusions, but could it be that wrapping
> with a mutex prevents CPU consumption anyhow? Could someone who
> deeply understands this, pitch in?

Mark's answer is the right one. In the case of Java, the surrounding
synchronized block provides that mutex.
> Another question, if someone knows something about the subject. I'm
> currently using a TimerTask to poll the filesystem. I'd rather,however,
> (if possible) plug in to some kind of filesystem notification system...
> Linux-only would do. I'm perfectly willing to native wrap stuff into
> CNI and delegate this to native methods. Any thoughts?

Discretionary locking might be what you're looking for. Look at fcntl
and F_SETLKW. There are similar mechanisms on win32.
Jeff


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /