Search code examples
javapolling

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


Solution

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