Java tutorial
//package com.java2s; /** ___ _ _ _ ___ _ _ _ | __(_)_ _ _____ __ ____ _| | | | _ \_ _ ___| |_ ___ __| |_(_)___ _ _ | _|| | '_/ -_) V V / _` | | | | _/ '_/ _ \ _/ -_) _| _| / _ \ ' \ |_| |_|_| \___|\_/\_/\__,_|_|_| |_| |_| \___/\__\___\__|\__|_\___/_||_| Developed by: Riccardo B. < riccardo@cryptolab.net > License: GNU GPL v3 **/ import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class Main { protected static ScheduledThreadPoolExecutor EXECUTOR = new ScheduledThreadPoolExecutor(2); public static void scheduleTask(Runnable task, int delay) { EXECUTOR.schedule(task, delay, TimeUnit.MILLISECONDS); } }