Add java.time.Duration support in the JavaDSL in akka-actor module #24646 (#24883)

* Add java.time.Duration support in the JavaDSL in akka-actor module #24646
* add deprecation and change retry
This commit is contained in:
Patrik Nordwall 2018-04-11 16:47:36 +02:00 committed by GitHub
parent e18382bb0f
commit 6a9fa1946d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 419 additions and 80 deletions

View file

@ -6,12 +6,11 @@ package jdocs.circuitbreaker;
import akka.actor.ActorRef;
import akka.actor.ReceiveTimeout;
import akka.actor.AbstractActor.Receive;
import akka.actor.AbstractActor;
import akka.event.Logging;
import akka.event.LoggingAdapter;
import akka.pattern.CircuitBreaker;
import scala.concurrent.duration.Duration;
import java.time.Duration;
public class TellPatternJavaActor extends AbstractActor {
@ -23,7 +22,7 @@ public class TellPatternJavaActor extends AbstractActor {
this.target = targetActor;
this.breaker = new CircuitBreaker(
getContext().dispatcher(), getContext().system().scheduler(),
5, Duration.create(10, "s"), Duration.create(1, "m"))
5, Duration.ofSeconds(10), Duration.ofMinutes(1))
.onOpen(new Runnable() {
public void run() {
notifyMeOnOpen();