public static ThreadFactory getThreadFactory ( String groupName ) { return new ThreadFactory ( ) { final AtomicInteger threadCount = new AtomicInteger ( ) ; @ Override public Thread newThread ( Runnable r ) { Thread thread = new Thread ( r , groupName + "-" + threadCount . incrementAndGet ( ) ) ; thread . setDaemon ( true ) ; return thread ; } } ; }
Creates and returns a thread factory that will create threads with the given name prefix .