2

I wrote a code to read a file and update a database with is contents. I'm using timer task to do this process every 15 minutes. But I want to do this at the exact time when the file is updated/changed. Not every 15 minutes. I took a look for this but couldn't find something helpful. Can anyone help me?

Thanks.

Arda Oğul Üçpınar
  • 881
  • 1
  • 14
  • 38

1 Answers1

3

You can use Java 7's WatchService to accomplish this for you. Here's the official tutorial.

Jeffrey
  • 44,417
  • 8
  • 90
  • 141