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

@ -11,7 +11,7 @@ import akka.japi.pf.UnitMatch;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import scala.concurrent.duration.Duration;
import java.time.Duration;
//#simple-imports
import static jdocs.actor.fsm.Buncher.Data;
@ -45,7 +45,7 @@ public class Buncher extends AbstractFSM<State, Data> {
state(Idle, Active, () -> {/* Do something here */}));
//#transition-elided
when(Active, Duration.create(1, "second"),
when(Active, Duration.ofSeconds(1L),
matchEvent(Arrays.asList(Flush.class, StateTimeout()), Todo.class,
(event, todo) -> goTo(Idle).using(todo.copy(new LinkedList<>()))));