Exemplo n.º 1
0
class DaemonThreadFactory implements ThreadFactory {

  static final ThreadFactory INSTANCE = new DaemonThreadFactory();

  private static final ThreadFactory DEFAULT = Executors.defaultThreadFactory();

  public Thread newThread(Runnable r) {
    Thread t = DEFAULT.newThread(r);
    t.setDaemon(true);
    return t;
  }
}