bc0026c3e1
Plus many new examples in "streams" chapter.
13 lines
268 B
Java
13 lines
268 B
Java
// onjava/DaemonThreadFactory.java
|
|
package onjava;
|
|
import java.util.concurrent.*;
|
|
|
|
public class DaemonThreadFactory implements ThreadFactory {
|
|
@Override
|
|
public Thread newThread(Runnable r) {
|
|
Thread t = new Thread(r);
|
|
t.setDaemon(true);
|
|
return t;
|
|
}
|
|
}
|