Java tutorial
//package com.java2s; //License from project: Apache License import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; public class Main { public static void newScheduledThreadPoolAtFixedRate(Runnable runnable, long delayTime, long period, int size) { ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(size); scheduledThreadPool.scheduleAtFixedRate(runnable, delayTime, period, TimeUnit.SECONDS); } }