Java tutorial
//package com.java2s; //License from project: Apache License import java.util.concurrent.ThreadFactory; public class Main { /** * New thread creation factory * @param name name of thread * @param daemon if its daemon or not. * @return ThreadFactory instance initialized for given values. */ public static ThreadFactory threadFactory(final String name, final boolean daemon) { return new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread thread = new Thread(r, name); thread.setDaemon(daemon); return thread; } }; } }