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 com.twitter.util.{Duration, Future, FuturePool, Try} | |
import java.util.concurrent.{LinkedBlockingQueue, ThreadPoolExecutor, TimeUnit} | |
val poolSize = 4 | |
val queue = new LinkedBlockingQueue[Runnable]() | |
val executor = new ThreadPoolExecutor(poolSize, poolSize, 0L, TimeUnit.MILLISECONDS, queue) | |
val futurePool = FuturePool(executor) | |
def doWork(n: Int): Int = { | |
Thread.sleep(1000) |