What is the easiest way to have a piece of Java code scheduled at a given rate ?
By using a ScheduledExecutorService.
Have a look at Executors.newScheduledThreadPool. It will allow you to created a ScheduledExecutorService which lets you submit Runnables to be executed at regular intervals.
Executors.newScheduledThreadPool
ScheduledExecutorService
Runnable