java - Reading from new folders every x seconds and using their data -
currently writing application in java looks through files in directory (call 'topics'). within directory number of folders named after respective topics, maybe 'dog', 'cat', etc. i using scheduledexecutorservice through directory every 30 seconds, going through each topic folder , performing operation on contents in folder (we'll other independent piece of code writing these topic folders, maybe log file or something). what best way examine new subdirectories each 30 seconds? if start topic dog, , somewhere between 30 seconds topics 'cat' , 'bird' added, best way me through new folders? thinking comparing hashset or something, i'm not sure efficient way this. i ask because there potentially great amount of subdirectories being created, , seems me problematic try loop through each 1 directory.listfiles(). advice? use java's watchservice api. the watchservice api low level, allowing customize it. can use is, or c