Merge branch 'master' into wip-1503-remove-stm-patriknw
Conflicts: akka-actor-tests/src/test/scala/akka/actor/SchedulerSpec.scala akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala akka-docs/modules/camel.rst
This commit is contained in:
commit
e456213e31
179 changed files with 2334 additions and 2138 deletions
|
|
@ -4,6 +4,8 @@ package akka.docs.actor
|
|||
import akka.actor.Actor
|
||||
import akka.actor.Props
|
||||
import akka.event.Logging
|
||||
import akka.dispatch.Future
|
||||
|
||||
//#imports1
|
||||
|
||||
//#imports2
|
||||
|
|
@ -40,7 +42,7 @@ class FirstActor extends Actor {
|
|||
case DoIt(msg) ⇒
|
||||
val replyMsg = doSomeDangerousWork(msg)
|
||||
sender ! replyMsg
|
||||
self.stop()
|
||||
context.stop(self)
|
||||
}
|
||||
def doSomeDangerousWork(msg: ImmutableMessage): String = { "done" }
|
||||
})) ! m
|
||||
|
|
@ -143,7 +145,7 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
|
|||
//#import-context
|
||||
|
||||
val first = system.actorOf(Props(new FirstActor))
|
||||
first.stop()
|
||||
system.stop(first)
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +171,7 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
|
|||
system.eventStream.unsubscribe(testActor)
|
||||
system.eventStream.publish(TestEvent.UnMute(filter))
|
||||
|
||||
myActor.stop()
|
||||
system.stop(myActor)
|
||||
}
|
||||
|
||||
"creating actor with constructor" in {
|
||||
|
|
@ -182,7 +184,7 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
|
|||
val myActor = system.actorOf(Props(new MyActor("...")))
|
||||
//#creating-constructor
|
||||
|
||||
myActor.stop()
|
||||
system.stop(myActor)
|
||||
}
|
||||
|
||||
"creating actor with Props" in {
|
||||
|
|
@ -192,7 +194,7 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
|
|||
val myActor = system.actorOf(Props[MyActor].withDispatcher(dispatcher), name = "myactor")
|
||||
//#creating-props
|
||||
|
||||
myActor.stop()
|
||||
system.stop(myActor)
|
||||
}
|
||||
|
||||
"using ask" in {
|
||||
|
|
@ -207,14 +209,12 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
|
|||
val myActor = system.actorOf(Props(new MyActor))
|
||||
implicit val timeout = system.settings.ActorTimeout
|
||||
val future = myActor ? "hello"
|
||||
future.as[String] match {
|
||||
case Some(answer) ⇒ //...
|
||||
case None ⇒ //...
|
||||
}
|
||||
val result: Option[Int] = for (x ← (myActor ? 3).as[Int]) yield { 2 * x }
|
||||
for (x ← future) println(x) //Prints "hello"
|
||||
|
||||
val result: Future[Int] = for (x ← (myActor ? 3).mapTo[Int]) yield { 2 * x }
|
||||
//#using-ask
|
||||
|
||||
myActor.stop()
|
||||
system.stop(myActor)
|
||||
}
|
||||
|
||||
"using receiveTimeout" in {
|
||||
|
|
|
|||
|
|
@ -16,27 +16,35 @@ object DispatcherDocSpec {
|
|||
val config = """
|
||||
//#my-dispatcher-config
|
||||
my-dispatcher {
|
||||
type = Dispatcher # Dispatcher is the name of the event-based dispatcher
|
||||
daemonic = off # Toggles whether the threads created by this dispatcher should be daemons or not
|
||||
core-pool-size-min = 2 # minimum number of threads to cap factor-based core number to
|
||||
core-pool-size-factor = 2.0 # No of core threads ... ceil(available processors * factor)
|
||||
core-pool-size-max = 10 # maximum number of threads to cap factor-based number to
|
||||
throughput = 100 # Throughput defines the number of messages that are processed in a batch before the
|
||||
# thread is returned to the pool. Set to 1 for as fair as possible.
|
||||
# Dispatcher is the name of the event-based dispatcher
|
||||
type = Dispatcher
|
||||
# Toggles whether the threads created by this dispatcher should be daemons or not
|
||||
daemonic = off
|
||||
# minimum number of threads to cap factor-based core number to
|
||||
core-pool-size-min = 2
|
||||
# No of core threads ... ceil(available processors * factor)
|
||||
core-pool-size-factor = 2.0
|
||||
# maximum number of threads to cap factor-based number to
|
||||
core-pool-size-max = 10
|
||||
# Throughput defines the number of messages that are processed in a batch before the
|
||||
# thread is returned to the pool. Set to 1 for as fair as possible.
|
||||
throughput = 100
|
||||
}
|
||||
//#my-dispatcher-config
|
||||
|
||||
|
||||
//#my-bounded-config
|
||||
my-dispatcher-bounded-queue {
|
||||
type = Dispatcher
|
||||
core-pool-size-factor = 8.0
|
||||
max-pool-size-factor = 16.0
|
||||
task-queue-size = 100 # Specifies the bounded capacity of the task queue
|
||||
task-queue-type = "array" # Specifies which type of task queue will be used, can be "array" or "linked" (default)
|
||||
# Specifies the bounded capacity of the task queue
|
||||
task-queue-size = 100
|
||||
# Specifies which type of task queue will be used, can be "array" or "linked" (default)
|
||||
task-queue-type = "array"
|
||||
throughput = 3
|
||||
}
|
||||
//#my-bounded-config
|
||||
|
||||
|
||||
//#my-balancing-config
|
||||
my-balancing-dispatcher {
|
||||
type = BalancingDispatcher
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue