Here you can find the source of executeInDaemon(Runnable... run)
public static void executeInDaemon(Runnable... run)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; public class Main { public static void executeInDaemon(Runnable... run) { int i = run.length; ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor( i, new ThreadFactory() { @Override/* w w w .j av a2s . c o m*/ public Thread newThread(Runnable r) { Thread t = new Thread(); t.setDaemon(true); return t; } }); while (--i >= 0) { executor.scheduleAtFixedRate(run[i], 0, 40, TimeUnit.MILLISECONDS); } } }