Here you can find the source of CreateThreadFactory(final ThreadGroup tg, final String threadName)
public static ThreadFactory CreateThreadFactory(final ThreadGroup tg, final String threadName)
//package com.java2s; import java.util.concurrent.ThreadFactory; public class Main { public static ThreadFactory CreateThreadFactory(final ThreadGroup tg, final String threadName) { final ThreadFactory threadFactory = new ThreadFactory() { public Thread newThread(Runnable command) { Thread thread = new Thread(tg, command, threadName); thread.setDaemon(true);//ww w. j a v a 2 s . co m return thread; } }; return threadFactory; } }