I have a Java EE application which downloads stock prices from the internet every fifteen minutes. From a timing accuracy perspective is is best for the application to internalise this periodic operation i.e. use Thread.sleep()
in combination with a counter or set up a timer Or would it be better to expose the task via a URL and have a platform cron job hit the URL periodically (at the the required frequency of course).
What are the pros and cons of both approaches?
I've been spooked by a timer bug I saw reported against the OpenJDK implementation. The bug stated that changes in the system time affected the operation of the time related operations and methods such as sleep and timer periodicity.