ViS ViS - 4 months ago 21
Java Question

Design help to schedule file polling and api call

What is the best way to schedule a java program, after searching for some time we came across below 3 ways, which is the better of these three, is something that is getting us confused and if there is any better way please let us know.

One way 1:
Create a windows task scheduler service to execute a standalone java program to fetch file info and make webService call. Like this)

Second way 2:
Create a quartz scheduler service to execute a standalone java program to fetch file info and make webService call. Like this

Third way 3:
Use TimerTask(available in java.util package) to execute task in another class.like this

Please suggest which is better way to do it.

Answer Source

Solution 3, would be running throughout all time and will be in memory all time.

I feel you go with solution 2, as quartz gives you OS independence and allows have more options that windows scheduler.

Don't understand the down votes as you had done your research but asking for additional suggestion though.