1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
package dotty.tools package io import java.util.concurrent._ class DaemonThreadFactory extends ThreadFactory { def newThread(r: Runnable): Thread = { val thread = new Thread(r) thread setDaemon true thread } } object DaemonThreadFactory { def newPool() = Executors.newCachedThreadPool(new DaemonThreadFactory) }