ThreadFactory newThreadFactory = new ThreadFactory() {
private final AtomicInteger threadId = new AtomicInteger(0);
public Thread newThread(Runnable runnable) {
Thread t = originalThreadFactory.newThread(
new NamePreservingRunnable(
runnable,
ExecutorThreadModel.this.threadNamePrefix + '-' +
threadId.incrementAndGet()));
t.setDaemon(true);
return t;