forked from Doikor/akka
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request akka#17925 from ktoso/wip-move-BackoffSupervisor-k…
…toso !per +act akka#17842 move BackoffSupervisor to akka.pattern
- Loading branch information
Showing
13 changed files
with
123 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
akka-docs/rst/java/code/docs/pattern/BackoffSupervisorDocTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> | ||
*/ | ||
package docs.pattern; | ||
|
||
import akka.actor.*; | ||
import akka.pattern.BackoffSupervisor; | ||
import akka.testkit.TestActors.EchoActor; | ||
//#backoff-imports | ||
import scala.concurrent.duration.Duration; | ||
//#backoff-imports | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
public class BackoffSupervisorDocTest { | ||
|
||
void example (ActorSystem system) { | ||
//#backoff | ||
final Props childProps = Props.create(EchoActor.class); | ||
|
||
final Props supervisorProps = BackoffSupervisor.props( | ||
childProps, | ||
"myEcho", | ||
Duration.create(3, TimeUnit.SECONDS), | ||
Duration.create(30, TimeUnit.SECONDS), | ||
0.2); // adds 20% "noise" to vary the intervals slightly | ||
|
||
system.actorOf(supervisorProps, "echoSupervisor"); | ||
//#backoff | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
akka-docs/rst/scala/code/docs/pattern/BackoffSupervisorDocSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> | ||
*/ | ||
|
||
package docs.pattern | ||
|
||
import akka.actor.{ActorSystem, Props} | ||
import akka.pattern.BackoffSupervisor | ||
import akka.testkit.TestActors.EchoActor | ||
|
||
class BackoffSupervisorDocSpec { | ||
|
||
class BackoffSupervisorDocSpecExample { | ||
val system: ActorSystem = ??? | ||
import scala.concurrent.duration._ | ||
|
||
//#backoff | ||
val childProps = Props(classOf[EchoActor]) | ||
|
||
val supervisor = BackoffSupervisor.props( | ||
childProps, | ||
childName = "myEcho", | ||
minBackoff = 3.seconds, | ||
maxBackoff = 30.seconds, | ||
randomFactor = 0.2) // adds 20% "noise" to vary the intervals slightly | ||
|
||
system.actorOf(supervisor, name = "echoSupervisor") | ||
//#backoff | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters