diff options
author | Heather Miller <heather.miller@epfl.ch> | 2012-02-25 17:36:08 +0100 |
---|---|---|
committer | Heather Miller <heather.miller@epfl.ch> | 2012-02-25 17:36:08 +0100 |
commit | 76e9da2ca4c31daec2b04848c3c2dbad6ecd426e (patch) | |
tree | d8f27ad3952d43c2049805cb8805ea3479431dc8 /src/actors | |
parent | 0c2f493804db6b594d7ec68e49e76c75a316230b (diff) | |
download | scala-76e9da2ca4c31daec2b04848c3c2dbad6ecd426e.tar.gz scala-76e9da2ca4c31daec2b04848c3c2dbad6ecd426e.tar.bz2 scala-76e9da2ca4c31daec2b04848c3c2dbad6ecd426e.zip |
Added updated ForkJoinPool, w/ necessary updates to Scala Actors.
This commit includes Doug Lea's updates to ForkJoinPool, as of January
25th, 2012. Details of the changes and performance improvements
available at: http://markmail.org/message/323vxzn6irkk5yrg.
The ForkJoinPool used in this commit comes from the most recent JSR166y.
Additionally, also included are minimal changes to parts of the Scala
Actors library which interface with the ForkJoinPool, as the
ForkJoinPool's interface has changed (prior to the release of Java 7)
since we last updated it for the Scala 2.8 release.
Of note- this is part of the planned overhaul of scala.concurrent,
and corresponds to ticket SI-5523.
For testing this was built on JDK 1.6, and passes all tests on both
JDK 1.5 and 1.6.
A new forkjoin.jar is necessary prior to applying these changes.
Using this source, the new jar can be built by running:
ant newforkjoin forkjoin.done
This creates a new forkjoin.jar in build/libs/. It must replace
lib/forkjoin.jar.
Diffstat (limited to 'src/actors')
-rw-r--r-- | src/actors/scala/actors/scheduler/DrainableForkJoinPool.scala | 4 | ||||
-rw-r--r-- | src/actors/scala/actors/scheduler/ForkJoinScheduler.scala | 9 |
2 files changed, 4 insertions, 9 deletions
diff --git a/src/actors/scala/actors/scheduler/DrainableForkJoinPool.scala b/src/actors/scala/actors/scheduler/DrainableForkJoinPool.scala index 257fe92a91..15ce60566a 100644 --- a/src/actors/scala/actors/scheduler/DrainableForkJoinPool.scala +++ b/src/actors/scala/actors/scheduler/DrainableForkJoinPool.scala @@ -4,9 +4,9 @@ package scheduler import java.util.Collection import scala.concurrent.forkjoin.{ForkJoinPool, ForkJoinTask} -private class DrainableForkJoinPool extends ForkJoinPool { +private class DrainableForkJoinPool(parallelism: Int, maxPoolSize: Int) extends ForkJoinPool(parallelism, ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true) { - override def drainTasksTo(c: Collection[ForkJoinTask[_]]): Int = + override def drainTasksTo(c: Collection[ _ >: ForkJoinTask[_]]): Int = super.drainTasksTo(c) } diff --git a/src/actors/scala/actors/scheduler/ForkJoinScheduler.scala b/src/actors/scala/actors/scheduler/ForkJoinScheduler.scala index ba0f88c668..ce67ffd037 100644 --- a/src/actors/scala/actors/scheduler/ForkJoinScheduler.scala +++ b/src/actors/scala/actors/scheduler/ForkJoinScheduler.scala @@ -38,13 +38,8 @@ class ForkJoinScheduler(val initCoreSize: Int, val maxSize: Int, daemon: Boolean } private def makeNewPool(): DrainableForkJoinPool = { - val p = new DrainableForkJoinPool() - // enable locally FIFO scheduling mode - p.setAsyncMode(true) - p.setParallelism(initCoreSize) - p.setMaximumPoolSize(maxSize) + val p = new DrainableForkJoinPool(initCoreSize, maxSize) Debug.info(this+": parallelism "+p.getParallelism()) - Debug.info(this+": max pool size "+p.getMaximumPoolSize()) p } @@ -144,7 +139,7 @@ class ForkJoinScheduler(val initCoreSize: Int, val maxSize: Int, daemon: Boolean ForkJoinPool.managedBlock(new ForkJoinPool.ManagedBlocker { def block = blocker.block() def isReleasable() = blocker.isReleasable - }, true) + }) } /** Suspends the scheduler. All threads that were in use by the |