This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent._ | |
/** | |
* A thread pool for superstitious parent threads who | |
* know they shouldn't let their child threads back in the pool after | |
* eating, without waiting at least `crampFactor` milliseconds. | |
*/ | |
object Superstitious { | |
def pool(crampFactor: Long) = new ThreadPoolExecutor( | |
0, Int.MaxValue, 60L, TimeUnit.SECONDS, new SynchronousQueue[Runnable]) { |