scala.actors.scheduler

ThreadPoolScheduler

class ThreadPoolScheduler extends Thread with ExecutorScheduler with TerminationMonitor

The ThreadPoolScheduler class uses a ThreadPoolExecutor to execute Actors.

A ThreadPoolScheduler attempts to shut down the underlying ThreadPoolExecutor only if terminate is set to true.

Otherwise, the ThreadPoolExecutor must be shut down either directly or by shutting down the ThreadPoolScheduler instance.

Inherits

  1. TerminationMonitor
  2. ExecutorScheduler
  3. ThreadPoolRunner
  4. FutureTaskRunner
  5. TaskRunner
  6. IScheduler
  7. Thread
  8. Runnable
  9. AnyRef
  10. Any

Type Members

  1. type Future = Future[T]

  2. type Task = Callable[T] with Runnable

Value Members

  1. def allTerminated: Boolean

    Deprecated non-actor-private version

    Deprecated non-actor-private version

    definition classes: TerminationMonitor
  2. def countStackFrames(): Int

  3. def destroy(): Unit

  4. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    The default implementations of this method is an equivalence relation:

    • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
    • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
    • It is transitive: for any instances x, y, and z of type AnyRef if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

    If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is often necessary to override hashCode to ensure that objects that are "equal" (o1.equals(o2) returns true) hash to the same Int (o1.hashCode.equals(o2.hashCode)).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    definition classes: AnyRef ⇐ Any
  5. def execute(fun: ⇒ Unit): Unit

    Submits a closure for execution

    Submits a closure for execution.

    fun

    the closure to be executed

    definition classes: ExecutorScheduler ⇐ IScheduler
  6. def execute(task: Runnable): Unit

    Submits a Runnable for execution

    Submits a Runnable for execution.

    task

    the task to be executed

    definition classes: ExecutorScheduler ⇐ IScheduler
  7. def execute[S](task: Callable[S] with Runnable): Unit

  8. def executeFromActor(task: Runnable): Unit

  9. def functionAsTask[S](fun: () ⇒ S): Callable[S] with Runnable

  10. def futureAsFunction[S](x: Future[S]): () ⇒ S

  11. def getContextClassLoader(): ClassLoader

  12. def getId(): Long

  13. def getStackTrace(): Array[StackTraceElement]

  14. def getState(): State

  15. def getUncaughtExceptionHandler(): UncaughtExceptionHandler

  16. def hashCode(): Int

    Returns a hash code value for the object

    Returns a hash code value for the object.

    The default hashing algorithm is platform dependent.

    Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

    definition classes: AnyRef ⇐ Any
  17. def interrupt(): Unit

  18. def isActive: Boolean

    The scheduler is active if the underlying ExecutorService has not been shut down

    The scheduler is active if the underlying ExecutorService has not been shut down.

    definition classes: ExecutorScheduler ⇐ IScheduler
  19. def isInterrupted(): Boolean

  20. def managedBlock(blocker: ManagedBlocker): Unit

  21. def newActor(a: Reactor): Unit

    newActor is invoked whenever a new actor is started

    newActor is invoked whenever a new actor is started.

    definition classes: TerminationMonitor
  22. def onLockup(millis: Int)(handler: () ⇒ Unit): Unit

  23. def onLockup(handler: () ⇒ Unit): Unit

  24. def onShutdown(): Unit

    This method is called when the scheduler shuts down

    This method is called when the scheduler shuts down.

    definition classes: ExecutorScheduler
  25. def onTerminate(a: Reactor)(f: ⇒ Unit): Unit

    Registers a closure to be executed when the specified actor terminates

    Registers a closure to be executed when the specified actor terminates.

    a

    the actor

    f

    the closure to be registered

    definition classes: TerminationMonitor
  26. def printActorDump: Unit

  27. def run(): Unit

  28. def setContextClassLoader(arg0: ClassLoader): Unit

  29. def setUncaughtExceptionHandler(arg0: UncaughtExceptionHandler): Unit

  30. def shutdown(): Unit

    Shuts down the scheduler

    Shuts down the scheduler.

  31. def start(): Unit

  32. def submit[S](task: Callable[S] with Runnable): Future[S]

  33. def terminated(a: Reactor): Unit

    Registers that the specified actor has terminated

    Registers that the specified actor has terminated.

    a

    the actor that has terminated

    definition classes: TerminationMonitor
  34. def tick(a: Actor): Unit

  35. def toString(): String

    Returns a string representation of the object

    Returns a string representation of the object.

    The default representation is platform dependent.

    definition classes: Thread ⇐ AnyRef ⇐ Any

Instance constructors

  1. new ThreadPoolScheduler(d: Boolean)

  2. new ThreadPoolScheduler(executor: ThreadPoolExecutor, terminate: Boolean, daemon: Boolean)

  3. new ThreadPoolScheduler(arg0: ThreadGroup, arg1: Runnable, arg2: String, arg3: Long)

  4. new ThreadPoolScheduler(arg0: ThreadGroup, arg1: Runnable, arg2: String)

  5. new ThreadPoolScheduler(arg0: Runnable, arg1: String)

  6. new ThreadPoolScheduler(arg0: ThreadGroup, arg1: String)

  7. new ThreadPoolScheduler(arg0: String)

  8. new ThreadPoolScheduler(arg0: ThreadGroup, arg1: Runnable)

  9. new ThreadPoolScheduler(arg0: Runnable)

  10. new ThreadPoolScheduler()