You can create flexible and effective timer using Java's ExecutorService
:
// create executor that consists of 1 thread
final ExecutorService e = Executors.newScheduledThreadPool(1);
// schedule it to execute every 5000 ms starting from now
((ScheduledExecutorService) e).scheduleAtFixedRate(new Runnable(){
@Override
public void run() {
// your repeating task
}
}, 0, 5000, TimeUnit.MILLISECONDS);
This approach is more flexible and, if Java docs don't lie, more precise since it is independent on system clock changes.
http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html