• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamically reading the files at runtime

 
Faraz Ka
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

My web Application when gets started reads from a file system for files and does some processing.
Every time the folder gets updated with new files, the web Application needs to be relaunched.

Any clue how to make it dynamic so that when the new file gets added it is picked for processing without a restart?

Thanks,
Faraz
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're using Java 7 you can use a built-in API: http://docs.oracle.com/javase/tutorial/essential/io/notification.html. Otherwise you will have to write your own task that scans the directory regularly for changes (maybe using the java.util.Timer and TimerTask classes).
 
Faraz Ka
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ulf,

I'm using Java 7 and hence will try out the API that you mentioned.

Thanks,
Faraz
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic