@Test public void createNewThreadShouldAssignAnNameToIt() { NamedThreadFactory factory = new NamedThreadFactory("custom-name", false); Thread createdThread = factory.newThread(DEFAULT_RUNNABLE); assertEquals("custom-name-0", createdThread.getName()); }
public Thread newThread(Runnable r) { Thread t = new Thread(r, this.name + "-" + this.id.getAndIncrement()); t.setDaemon(this.daemon); return t; }
NamedThreadFactory implements ThreadFactory { public Thread newThread(Runnable r) { Thread t = new Thread(r, this.name + "-" + this.id.getAndIncrement()); t.setDaemon(this.daemon); return t; } }
NamedThreadFactory implements ThreadFactory { public Thread newThread(Runnable r) { Thread t = new Thread(r, this.name + "-" + this.id.getAndIncrement()); t.setDaemon(this.daemon); return t; } NamedThreadFactory(String name, boolean daemon); }
NamedThreadFactory implements ThreadFactory { public Thread newThread(Runnable r) { Thread t = new Thread(r, this.name + "-" + this.id.getAndIncrement()); t.setDaemon(this.daemon); return t; } NamedThreadFactory(String name, boolean daemon); Thread newThread(Runnable r); }
NamedThreadFactory implements ThreadFactory { public Thread newThread(Runnable r) { Thread t = new Thread(r, this.name + "-" + this.id.getAndIncrement()); t.setDaemon(this.daemon); return t; } NamedThreadFactory(String name, boolean daemon); Thread newThread(Runnable r);  }