diff options
author | Philipp Haller <hallerp@gmail.com> | 2009-09-24 18:28:17 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2009-09-24 18:28:17 +0000 |
commit | 92fc7b37b01bc871966a49524197c1cbbeec8988 (patch) | |
tree | 7fad3d6cff9bf825e7018d26407413988c9a04f4 /src/library | |
parent | 6fea2488af12d942c1cf7ba781d2f60fe6ddc9c0 (diff) | |
download | scala-92fc7b37b01bc871966a49524197c1cbbeec8988.tar.gz scala-92fc7b37b01bc871966a49524197c1cbbeec8988.tar.bz2 scala-92fc7b37b01bc871966a49524197c1cbbeec8988.zip |
Introduced actors package object to deprecate a...
Introduced actors package object to deprecate a number of
classes. Made ForkJoinScheduler more configurable and let it read
ThreadPoolConfig. Clean-ups in TerminationMonitor and ActorGC. Removed
DefaultExecutorScheduler. Made DelegatingScheduler and ExecutorScheduler
private. Deprecated MessageQueue and MessageQueueElement, so that we can
later make them private. Deprecated a number of methods in IScheduler.
Tightened access modifiers in Reactor.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/concurrent/ThreadPoolRunner.scala | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/library/scala/concurrent/ThreadPoolRunner.scala b/src/library/scala/concurrent/ThreadPoolRunner.scala index 9dd89afc02..925a5ebee1 100644 --- a/src/library/scala/concurrent/ThreadPoolRunner.scala +++ b/src/library/scala/concurrent/ThreadPoolRunner.scala @@ -13,14 +13,16 @@ package scala.concurrent import java.util.concurrent.{ExecutorService, Callable, TimeUnit} -/** The <code>ThreadPoolRunner</code> trait... +/** The <code>ThreadPoolRunner</code> trait uses + * a <code>java.util.concurrent.ExecutorService</code> + * to run submitted tasks. * * @author Philipp Haller */ trait ThreadPoolRunner extends FutureTaskRunner { type Task[T] = Callable[T] with Runnable - type Future[T] = RichFuture[T] + type Future[T] = java.util.concurrent.Future[T] private class RunCallable[S](fun: () => S) extends Runnable with Callable[S] { def run() = fun() @@ -33,13 +35,10 @@ trait ThreadPoolRunner extends FutureTaskRunner { implicit def futureAsFunction[S](x: Future[S]): () => S = () => x.get() - trait RichFuture[S] extends java.util.concurrent.Future[S] - with (() => S) - protected def executor: ExecutorService def submit[S](task: Task[S]): Future[S] = { - toRichFuture(executor.submit[S](task)) + executor.submit[S](task) } def execute[S](task: Task[S]) { @@ -50,14 +49,4 @@ trait ThreadPoolRunner extends FutureTaskRunner { blocker.block() } - private def toRichFuture[S](future: java.util.concurrent.Future[S]) = - new RichFuture[S] { - def cancel(mayInterrupt: Boolean) = future cancel mayInterrupt - def get() = future.get() - def get(timeout: Long, unit: TimeUnit) = future.get(timeout, unit) - def isCancelled() = future.isCancelled() - def isDone() = future.isDone() - def apply() = future.get() - } - } |