Merge branch 'master' into wip-1537-moar-futuredocs-√
This commit is contained in:
commit
eca809675a
52 changed files with 552 additions and 230 deletions
|
|
@ -20,13 +20,14 @@ object FaultHandlingDocSpec {
|
|||
//#strategy
|
||||
import akka.actor.OneForOneStrategy
|
||||
import akka.actor.SupervisorStrategy._
|
||||
import akka.util.duration._
|
||||
|
||||
override val supervisorStrategy = OneForOneStrategy({
|
||||
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
|
||||
case _: ArithmeticException ⇒ Resume
|
||||
case _: NullPointerException ⇒ Restart
|
||||
case _: IllegalArgumentException ⇒ Stop
|
||||
case _: Exception ⇒ Escalate
|
||||
}: Decider, maxNrOfRetries = Some(10), withinTimeRange = Some(60000))
|
||||
}
|
||||
//#strategy
|
||||
|
||||
def receive = {
|
||||
|
|
@ -40,13 +41,14 @@ object FaultHandlingDocSpec {
|
|||
//#strategy2
|
||||
import akka.actor.OneForOneStrategy
|
||||
import akka.actor.SupervisorStrategy._
|
||||
import akka.util.duration._
|
||||
|
||||
override val supervisorStrategy = OneForOneStrategy({
|
||||
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
|
||||
case _: ArithmeticException ⇒ Resume
|
||||
case _: NullPointerException ⇒ Restart
|
||||
case _: IllegalArgumentException ⇒ Stop
|
||||
case _: Exception ⇒ Escalate
|
||||
}: Decider, maxNrOfRetries = Some(10), withinTimeRange = Some(60000))
|
||||
}
|
||||
//#strategy2
|
||||
|
||||
def receive = {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class CountExtensionImpl extends Extension {
|
|||
//#extensionid
|
||||
import akka.actor.ExtensionId
|
||||
import akka.actor.ExtensionIdProvider
|
||||
import akka.actor.ActorSystemImpl
|
||||
import akka.actor.ExtendedActorSystem
|
||||
|
||||
object CountExtension
|
||||
extends ExtensionId[CountExtensionImpl]
|
||||
|
|
@ -36,7 +36,7 @@ object CountExtension
|
|||
|
||||
//This method will be called by Akka
|
||||
// to instantiate our Extension
|
||||
override def createExtension(system: ActorSystemImpl) = new CountExtensionImpl
|
||||
override def createExtension(system: ExtendedActorSystem) = new CountExtensionImpl
|
||||
}
|
||||
//#extensionid
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package akka.docs.extension
|
|||
import akka.actor.Extension
|
||||
import akka.actor.ExtensionId
|
||||
import akka.actor.ExtensionIdProvider
|
||||
import akka.actor.ActorSystemImpl
|
||||
import akka.actor.ExtendedActorSystem
|
||||
import akka.util.Duration
|
||||
import com.typesafe.config.Config
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
|
@ -29,7 +29,7 @@ object Settings extends ExtensionId[SettingsImpl] with ExtensionIdProvider {
|
|||
|
||||
override def lookup = Settings
|
||||
|
||||
override def createExtension(system: ActorSystemImpl) = new SettingsImpl(system.settings.config)
|
||||
override def createExtension(system: ExtendedActorSystem) = new SettingsImpl(system.settings.config)
|
||||
}
|
||||
//#extensionid
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ that the respective limit does not apply, leaving the possibility to specify an
|
|||
absolute upper limit on the restarts or to make the restarts work infinitely.
|
||||
|
||||
The match statement which forms the bulk of the body is of type ``Decider``,
|
||||
which is a ``PartialFunction[Throwable, Action]``, and we need to help out the
|
||||
type inferencer a bit here by ascribing that type after the closing brace. This
|
||||
which is a ``PartialFunction[Throwable, Action]``. This
|
||||
is the piece which maps child failure types to their corresponding actions.
|
||||
|
||||
Practical Application
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.. _fsm:
|
||||
.. _fsm-scala:
|
||||
|
||||
###
|
||||
FSM
|
||||
|
|
@ -21,7 +21,8 @@ A FSM can be described as a set of relations of the form:
|
|||
|
||||
These relations are interpreted as meaning:
|
||||
|
||||
*If we are in state S and the event E occurs, we should perform the actions A and make a transition to the state S'.*
|
||||
*If we are in state S and the event E occurs, we should perform the actions A
|
||||
and make a transition to the state S'.*
|
||||
|
||||
A Simple Example
|
||||
================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue