Here you can find the source of createThreadFactory(final String prefix)
public static ThreadFactory createThreadFactory(final String prefix)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; public class Main { public static ThreadFactory createThreadFactory(final String prefix) { return new ThreadFactory() { private final ThreadFactory defaultThreadFactory = Executors.defaultThreadFactory(); private int i = 0; @Override/* ww w . j ava 2 s . c o m*/ public Thread newThread(Runnable r) { Thread t = this.defaultThreadFactory.newThread(r); t.setName(prefix + " #" + this.i); this.i++; return t; } }; } }