!per +act #17842 move BackoffSupervisor to akka.pattern

This commit is contained in:
Konrad Malawski 2015-07-07 16:28:17 +02:00
parent 403369a29e
commit 86c00d4716
13 changed files with 123 additions and 15 deletions

View file

@ -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
}
}