Java tutorial
//package com.java2s; //License from project: Apache License import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.util.concurrent.*; public class Main { /** * Wrapper over newSingleThreadScheduledExecutor. */ public static ScheduledExecutorService newDaemonSingleThreadScheduledExecutor(String threadName) { ThreadFactory threadFactory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat(threadName).build(); return Executors.newSingleThreadScheduledExecutor(threadFactory); } }