You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yeah, it's a bit awkward... if we wanted to we could have the WatchService implementation just get notified immediately whenever an event occurs that it might want to know about, but that would introduce more overhead for each operation that would count as an event (particularly any write to any file). The other major consideration I had was that near-synchronous notification of events is not something you're likely to get on any real file system, so it didn't make sense to me to have an implementation that would give you significantly different behavior than you'd get in a real file system.
All that said... I don't believe sleep should be called anywhere. PollingWatchService uses a ScheduledExecutorService to schedule its polling at a fixed rate, and from what I can tell that should be making use of wait()/notify() under the hood via a Condition.
Google policy forbids unit tests from calling sleep. If sleep is used, they have to be categorized as medium tests.
It would be nice if
PollingWatchService
was replaced with an implementation that uses mutex conditions, e.g. wait() and notify().The text was updated successfully, but these errors were encountered: