Rather than using Java’s static Thread.sleep method and calculating how many seconds you need to pass to its parameter, a simple class called TimeUnit simplifies its usage according to hours, minutes and seconds. You can use it using either of the following …

The sample above will run every hour, every 10 minutes and every 30 seconds. Pretty simple and much less tedious right?

Related Posts Plugin for WordPress, Blogger...