Here you can find the source of setTimeout(Long duration, Runnable csr)
public static void setTimeout(Long duration, Runnable csr)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; public class Main { public static void setTimeout(Long duration, Runnable csr) { final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.schedule(csr, duration, TimeUnit.MILLISECONDS); }/*from w w w . j a v a 2s. c o m*/ }