blob: d653271c1e0c5d8cab1bc52bbda37cbe9b870468 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2005-2010, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala.actors
import java.util.concurrent._
import scheduler.{DelegatingScheduler, ForkJoinScheduler, ResizableThreadPoolScheduler, ThreadPoolConfig}
/**
* The <code>Scheduler</code> object is used by <code>Actor</code> to
* execute tasks of an actor execution.
*
* @author Philipp Haller
*/
object Scheduler extends DelegatingScheduler {
Debug.info("initializing "+this+"...")
def makeNewScheduler: IScheduler = {
val sched = if (!ThreadPoolConfig.useForkJoin) {
val s = new ResizableThreadPoolScheduler(false)
s.start()
s
} else {
val s = new ForkJoinScheduler
s.start()
s
}
Debug.info(this+": starting new "+sched+" ["+sched.getClass+"]")
sched
}
/* Only <code>ForkJoinScheduler</code> implements this method.
*/
@deprecated("snapshot will be removed")
def snapshot() {
if (sched.isInstanceOf[ForkJoinScheduler]) {
sched.asInstanceOf[ForkJoinScheduler].snapshot()
} else
error("scheduler does not implement snapshot")
}
/* Only <code>ForkJoinScheduler</code> implements this method.
*/
@deprecated("restart will be removed")
def restart() {
if (sched.isInstanceOf[ForkJoinScheduler]) {
sched.asInstanceOf[ForkJoinScheduler].restart()
} else
error("scheduler does not implement restart")
}
}
|