user710818
user710818

Reputation: 24288

Java directory polling strategy

There is a directory in which files arrive at unpredictable times, but suppose that probability distribution is normal.

Average intervals for polling must be 1 minute.

Does there exist some strategy - e.g. change near 20% (+ or -) interval for polling or better polling in equal intervals? If yes - if possible please point to an algorithm in java

Upvotes: 2

Views: 1435

Answers (3)

Shravan Ramamurthy
Shravan Ramamurthy

Reputation: 4096

You can also implement this using awaitility. Please check here

Upvotes: 0

Dmitry
Dmitry

Reputation: 17350

Instead of polling yourself you might want to look at FileAlterationMonitor or JNotify or NIO (Java 7 only).

Upvotes: 4

Codo
Codo

Reputation: 78975

It might yet be too early for you, but Java 7 has new class WatchService for monitoring a directory for changes.

Upvotes: 2

Related Questions