Java tutorial
//package com.java2s; import java.util.concurrent.ThreadFactory; public class Main { static ThreadFactory threadFactory(final String name, final boolean daemon) { return new ThreadFactory() { @Override public Thread newThread(Runnable runnable) { Thread result = new Thread(runnable, name); result.setDaemon(daemon); return result; } }; } }