* Add java.time.Duration support in the JavaDSL in akka-actor module #24646 * add deprecation and change retry
This commit is contained in:
parent
e18382bb0f
commit
6a9fa1946d
35 changed files with 419 additions and 80 deletions
|
|
@ -412,7 +412,7 @@ public class ActorDocTest extends AbstractJavaTest {
|
|||
//#gracefulStop
|
||||
try {
|
||||
CompletionStage<Boolean> stopped =
|
||||
gracefulStop(actorRef, Duration.create(5, TimeUnit.SECONDS), Manager.SHUTDOWN);
|
||||
gracefulStop(actorRef, java.time.Duration.ofSeconds(5), Manager.SHUTDOWN);
|
||||
stopped.toCompletableFuture().get(6, TimeUnit.SECONDS);
|
||||
// the actor has been stopped
|
||||
} catch (AskTimeoutException e) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import static akka.actor.SupervisorStrategy.restart;
|
|||
import static akka.actor.SupervisorStrategy.stop;
|
||||
import static akka.actor.SupervisorStrategy.escalate;
|
||||
|
||||
import static akka.pattern.Patterns.ask;
|
||||
import static akka.pattern.Patterns.pipe;
|
||||
|
||||
import static jdocs.actor.FaultHandlingDocSample.WorkerApi.*;
|
||||
|
|
@ -141,7 +140,7 @@ public class FaultHandlingDocSample {
|
|||
matchEquals(Start, x -> progressListener == null, x -> {
|
||||
progressListener = getSender();
|
||||
getContext().getSystem().scheduler().schedule(
|
||||
Duration.Zero(), Duration.create(1, "second"), getSelf(), Do,
|
||||
java.time.Duration.ZERO, java.time.Duration.ofSeconds(1L), getSelf(), Do,
|
||||
getContext().dispatcher(), null
|
||||
);
|
||||
}).
|
||||
|
|
|
|||
|
|
@ -4,15 +4,12 @@
|
|||
|
||||
package jdocs.actor;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import akka.testkit.AkkaJUnitActorSystemResource;
|
||||
import jdocs.AbstractJavaTest;
|
||||
import akka.testkit.javadsl.TestKit;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
|
||||
import scala.concurrent.duration.Duration;
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.ActorSystem;
|
||||
import akka.actor.Inbox;
|
||||
|
|
@ -20,6 +17,8 @@ import akka.actor.PoisonPill;
|
|||
import akka.actor.Terminated;
|
||||
import akka.testkit.AkkaSpec;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
public class InboxDocTest extends AbstractJavaTest {
|
||||
|
||||
@ClassRule
|
||||
|
|
@ -40,7 +39,7 @@ public class InboxDocTest extends AbstractJavaTest {
|
|||
probe.send(probe.getLastSender(), "world");
|
||||
//#inbox
|
||||
try {
|
||||
assert inbox.receive(Duration.create(1, TimeUnit.SECONDS)).equals("world");
|
||||
assert inbox.receive(Duration.ofSeconds(1)).equals("world");
|
||||
} catch (java.util.concurrent.TimeoutException e) {
|
||||
// timeout
|
||||
}
|
||||
|
|
@ -56,7 +55,7 @@ public class InboxDocTest extends AbstractJavaTest {
|
|||
inbox.watch(target);
|
||||
target.tell(PoisonPill.getInstance(), ActorRef.noSender());
|
||||
try {
|
||||
assert inbox.receive(Duration.create(1, TimeUnit.SECONDS)) instanceof Terminated;
|
||||
assert inbox.receive(Duration.ofSeconds(1)) instanceof Terminated;
|
||||
} catch (java.util.concurrent.TimeoutException e) {
|
||||
// timeout
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ package jdocs.actor;
|
|||
//#imports1
|
||||
import akka.actor.Props;
|
||||
import jdocs.AbstractJavaTest;
|
||||
import scala.concurrent.duration.Duration;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.time.Duration;
|
||||
//#imports1
|
||||
|
||||
//#imports2
|
||||
|
|
@ -34,12 +33,12 @@ public class SchedulerDocTest extends AbstractJavaTest {
|
|||
@Test
|
||||
public void scheduleOneOffTask() {
|
||||
//#schedule-one-off-message
|
||||
system.scheduler().scheduleOnce(Duration.create(50, TimeUnit.MILLISECONDS),
|
||||
system.scheduler().scheduleOnce(Duration.ofMillis(50),
|
||||
testActor, "foo", system.dispatcher(), null);
|
||||
//#schedule-one-off-message
|
||||
|
||||
//#schedule-one-off-thunk
|
||||
system.scheduler().scheduleOnce(Duration.create(50, TimeUnit.MILLISECONDS),
|
||||
system.scheduler().scheduleOnce(Duration.ofMillis(50),
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
@ -67,8 +66,8 @@ public class SchedulerDocTest extends AbstractJavaTest {
|
|||
|
||||
//This will schedule to send the Tick-message
|
||||
//to the tickActor after 0ms repeating every 50ms
|
||||
Cancellable cancellable = system.scheduler().schedule(Duration.Zero(),
|
||||
Duration.create(50, TimeUnit.MILLISECONDS), tickActor, "Tick",
|
||||
Cancellable cancellable = system.scheduler().schedule(Duration.ZERO,
|
||||
Duration.ofMillis(50), tickActor, "Tick",
|
||||
system.dispatcher(), null);
|
||||
|
||||
//This cancels further Ticks to be sent
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@
|
|||
package jdocs.actor;
|
||||
|
||||
//#timers
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import scala.concurrent.duration.Duration;
|
||||
import java.time.Duration;
|
||||
import akka.actor.AbstractActorWithTimers;
|
||||
|
||||
//#timers
|
||||
|
|
@ -24,8 +23,7 @@ public class TimerDocTest {
|
|||
}
|
||||
|
||||
public MyActor() {
|
||||
getTimers().startSingleTimer(TICK_KEY, new FirstTick(),
|
||||
Duration.create(500, TimeUnit.MILLISECONDS));
|
||||
getTimers().startSingleTimer(TICK_KEY, new FirstTick(), Duration.ofMillis(500));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -33,8 +31,7 @@ public class TimerDocTest {
|
|||
return receiveBuilder()
|
||||
.match(FirstTick.class, message -> {
|
||||
// do something useful here
|
||||
getTimers().startPeriodicTimer(TICK_KEY, new Tick(),
|
||||
Duration.create(1, TimeUnit.SECONDS));
|
||||
getTimers().startPeriodicTimer(TICK_KEY, new Tick(), Duration.ofSeconds(1));
|
||||
})
|
||||
.match(Tick.class, message -> {
|
||||
// do something useful here
|
||||
|
|
|
|||
|
|
@ -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<>()))));
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class FSMDocTest extends AbstractJavaTest {
|
|||
//#transition-syntax
|
||||
onTransition(
|
||||
matchState(Active, Idle, () -> setTimer("timeout",
|
||||
Tick, Duration.create(1, SECONDS), true)).
|
||||
Tick, java.time.Duration.ofSeconds(1L), true)).
|
||||
state(Active, null, () -> cancelTimer("timeout")).
|
||||
state(null, Idle, (f, t) -> log().info("entering Idle from " + f)));
|
||||
//#transition-syntax
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ package jdocs.circuitbreaker;
|
|||
|
||||
import akka.actor.AbstractActor;
|
||||
import akka.event.LoggingAdapter;
|
||||
import scala.concurrent.duration.Duration;
|
||||
import java.time.Duration;
|
||||
import akka.pattern.CircuitBreaker;
|
||||
import akka.event.Logging;
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class DangerousJavaActor extends AbstractActor {
|
|||
public DangerousJavaActor() {
|
||||
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))
|
||||
.addOnOpenListener(this::notifyMeOnOpen);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ package jdocs.circuitbreaker;
|
|||
|
||||
import akka.actor.AbstractActor;
|
||||
import akka.pattern.CircuitBreaker;
|
||||
import scala.concurrent.duration.Duration;
|
||||
import java.time.Duration;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.BiFunction;
|
||||
|
|
@ -18,7 +18,7 @@ public class EvenNoFailureJavaExample extends AbstractActor {
|
|||
public EvenNoFailureJavaExample() {
|
||||
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));
|
||||
}
|
||||
|
||||
public int luckyNumber() {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -8,14 +8,12 @@ import java.util.ArrayList;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import jdocs.cluster.StatsMessages.JobFailed;
|
||||
import jdocs.cluster.StatsMessages.StatsJob;
|
||||
import jdocs.cluster.StatsMessages.StatsResult;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import scala.concurrent.duration.Duration;
|
||||
import scala.concurrent.duration.FiniteDuration;
|
||||
import java.time.Duration;
|
||||
import akka.actor.ActorSelection;
|
||||
import akka.actor.Address;
|
||||
import akka.actor.Cancellable;
|
||||
|
|
@ -40,7 +38,7 @@ public class StatsSampleClient extends AbstractActor {
|
|||
|
||||
public StatsSampleClient(String servicePath) {
|
||||
this.servicePath = servicePath;
|
||||
FiniteDuration interval = Duration.create(2, TimeUnit.SECONDS);
|
||||
Duration interval = Duration.ofMillis(2);
|
||||
tickTask = getContext()
|
||||
.getSystem()
|
||||
.scheduler()
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@
|
|||
package jdocs.ddata;
|
||||
|
||||
//#data-bot
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
import scala.concurrent.duration.Duration;
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import akka.actor.AbstractActor;
|
||||
|
|
@ -37,7 +35,7 @@ public class DataBot extends AbstractActor {
|
|||
private final Cluster node = Cluster.get(getContext().getSystem());
|
||||
|
||||
private final Cancellable tickTask = getContext().getSystem().scheduler().schedule(
|
||||
Duration.create(5, SECONDS), Duration.create(5, SECONDS), getSelf(), TICK,
|
||||
Duration.ofSeconds(5), Duration.ofSeconds(5), getSelf(), TICK,
|
||||
getContext().dispatcher(), getSelf());
|
||||
|
||||
private final Key<ORSet<String>> dataKey = ORSetKey.create("key");
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ public class FutureDocTest extends AbstractJavaTest {
|
|||
//#retry
|
||||
final ExecutionContext ec = system.dispatcher();
|
||||
Callable<CompletionStage<String>> attempt = () -> CompletableFuture.completedFuture("test");
|
||||
CompletionStage<String> retriedFuture = retry(attempt, 3, Duration.create(200, "millis"), system.scheduler(), ec);
|
||||
CompletionStage<String> retriedFuture = retry(attempt, 3, java.time.Duration.ofMillis(200), system.scheduler(), ec);
|
||||
//#retry
|
||||
|
||||
retriedFuture.toCompletableFuture().get(2, SECONDS);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import akka.io.Tcp;
|
|||
import akka.io.TcpMessage;
|
||||
import akka.io.TcpSO;
|
||||
import akka.util.ByteString;
|
||||
import java.time.Duration;
|
||||
//#imports
|
||||
|
||||
public class IODocTest {
|
||||
|
|
@ -41,7 +42,8 @@ public class IODocTest {
|
|||
1234);
|
||||
final List<Inet.SocketOption> options = new ArrayList<Inet.SocketOption>();
|
||||
options.add(TcpSO.keepAlive(true));
|
||||
tcp.tell(TcpMessage.connect(remoteAddr, localAddr, options, null, false), getSelf());
|
||||
Duration timeout = null;
|
||||
tcp.tell(TcpMessage.connect(remoteAddr, localAddr, options, timeout, false), getSelf());
|
||||
//#connect-with-options
|
||||
})
|
||||
//#connected
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import akka.io.Inet;
|
|||
import akka.io.Tcp;
|
||||
import akka.io.TcpMessage;
|
||||
import akka.util.ByteString;
|
||||
import java.time.Duration;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -59,8 +60,9 @@ public class JavaReadBackPressure {
|
|||
private void demonstrateConnect() {
|
||||
//#pull-mode-connect
|
||||
final List<Inet.SocketOption> options = new ArrayList<Inet.SocketOption>();
|
||||
Duration timeout = null;
|
||||
tcp.tell(
|
||||
TcpMessage.connect(new InetSocketAddress("localhost", 3000), null, options, null, true),
|
||||
TcpMessage.connect(new InetSocketAddress("localhost", 3000), null, options, timeout, true),
|
||||
getSelf()
|
||||
);
|
||||
//#pull-mode-connect
|
||||
|
|
|
|||
|
|
@ -9,11 +9,9 @@ import akka.pattern.Backoff;
|
|||
import akka.pattern.BackoffSupervisor;
|
||||
import akka.testkit.TestActors.EchoActor;
|
||||
//#backoff-imports
|
||||
import scala.concurrent.duration.Duration;
|
||||
import java.time.Duration;
|
||||
//#backoff-imports
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class BackoffSupervisorDocTest {
|
||||
|
||||
void exampleStop (ActorSystem system) {
|
||||
|
|
@ -24,8 +22,8 @@ public class BackoffSupervisorDocTest {
|
|||
Backoff.onStop(
|
||||
childProps,
|
||||
"myEcho",
|
||||
Duration.create(3, TimeUnit.SECONDS),
|
||||
Duration.create(30, TimeUnit.SECONDS),
|
||||
Duration.ofSeconds(3),
|
||||
Duration.ofSeconds(30),
|
||||
0.2)); // adds 20% "noise" to vary the intervals slightly
|
||||
|
||||
system.actorOf(supervisorProps, "echoSupervisor");
|
||||
|
|
@ -40,8 +38,8 @@ public class BackoffSupervisorDocTest {
|
|||
Backoff.onFailure(
|
||||
childProps,
|
||||
"myEcho",
|
||||
Duration.create(3, TimeUnit.SECONDS),
|
||||
Duration.create(30, TimeUnit.SECONDS),
|
||||
Duration.ofSeconds(3),
|
||||
Duration.ofSeconds(30),
|
||||
0.2)); // adds 20% "noise" to vary the intervals slightly
|
||||
|
||||
system.actorOf(supervisorProps, "echoSupervisor");
|
||||
|
|
|
|||
|
|
@ -8,11 +8,10 @@ import akka.actor.*;
|
|||
import akka.japi.Procedure;
|
||||
import akka.pattern.BackoffSupervisor;
|
||||
import akka.persistence.*;
|
||||
import scala.concurrent.duration.Duration;
|
||||
import java.time.Duration;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class LambdaPersistenceDocTest {
|
||||
|
||||
|
|
@ -122,8 +121,8 @@ public class LambdaPersistenceDocTest {
|
|||
final Props props = BackoffSupervisor.props(
|
||||
childProps,
|
||||
"myActor",
|
||||
Duration.create(3, TimeUnit.SECONDS),
|
||||
Duration.create(30, TimeUnit.SECONDS),
|
||||
Duration.ofSeconds(3),
|
||||
Duration.ofSeconds(30),
|
||||
0.2);
|
||||
getContext().actorOf(props, "mySupervisor");
|
||||
super.preStart();
|
||||
|
|
|
|||
|
|
@ -17,14 +17,13 @@ import akka.actor.Props;
|
|||
import akka.persistence.query.EventEnvelope;
|
||||
import akka.stream.actor.ActorPublisherMessage.Cancel;
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.time.Duration;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
|
|
@ -47,7 +46,7 @@ class MyEventsByTagJavaPublisher extends AbstractActorPublisher<EventEnvelope> {
|
|||
public MyEventsByTagJavaPublisher(Connection connection,
|
||||
String tag,
|
||||
Long offset,
|
||||
FiniteDuration refreshInterval) {
|
||||
Duration refreshInterval) {
|
||||
this.connection = connection;
|
||||
this.tag = tag;
|
||||
this.currentOffset = offset;
|
||||
|
|
@ -72,7 +71,7 @@ class MyEventsByTagJavaPublisher extends AbstractActorPublisher<EventEnvelope> {
|
|||
}
|
||||
|
||||
public static Props props(Connection conn, String tag, Long offset,
|
||||
FiniteDuration refreshInterval) {
|
||||
Duration refreshInterval) {
|
||||
return Props.create(() ->
|
||||
new MyEventsByTagJavaPublisher(conn, tag, offset, refreshInterval));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ public class RouterDocTest extends AbstractJavaTest {
|
|||
//#scatter-gather-pool-1
|
||||
|
||||
//#scatter-gather-pool-2
|
||||
FiniteDuration within = FiniteDuration.create(10, TimeUnit.SECONDS);
|
||||
java.time.Duration within = java.time.Duration.ofSeconds(10);
|
||||
ActorRef router18 =
|
||||
getContext().actorOf(new ScatterGatherFirstCompletedPool(5, within).props(
|
||||
Props.create(Worker.class)), "router18");
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.concurrent.CompletionStage;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.time.Duration;
|
||||
|
||||
import akka.NotUsed;
|
||||
import jdocs.AbstractJavaTest;
|
||||
|
|
@ -207,7 +208,7 @@ public class StreamTestKitDocTest extends AbstractJavaTest {
|
|||
//#test-source-and-sink
|
||||
final Flow<Integer, Integer, NotUsed> flowUnderTest = Flow.of(Integer.class)
|
||||
.mapAsyncUnordered(2, sleep -> akka.pattern.PatternsCS.after(
|
||||
FiniteDuration.create(10, TimeUnit.MILLISECONDS),
|
||||
Duration.ofMillis(10),
|
||||
system.scheduler(),
|
||||
system.dispatcher(),
|
||||
CompletableFuture.completedFuture(sleep)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class RecipeGlobalRateLimit extends RecipeTest {
|
|||
public static final ReplenishTokens REPLENISH_TOKENS = new ReplenishTokens();
|
||||
|
||||
private final int maxAvailableTokens;
|
||||
private final FiniteDuration tokenRefreshPeriod;
|
||||
private final Duration tokenRefreshPeriod;
|
||||
private final int tokenRefreshAmount;
|
||||
|
||||
private final List<ActorRef> waitQueue = new ArrayList<>();
|
||||
|
|
@ -65,13 +65,13 @@ public class RecipeGlobalRateLimit extends RecipeTest {
|
|||
|
||||
private int permitTokens;
|
||||
|
||||
public static Props props(int maxAvailableTokens, FiniteDuration tokenRefreshPeriod,
|
||||
public static Props props(int maxAvailableTokens, Duration tokenRefreshPeriod,
|
||||
int tokenRefreshAmount) {
|
||||
return Props.create(Limiter.class, maxAvailableTokens, tokenRefreshPeriod,
|
||||
tokenRefreshAmount);
|
||||
}
|
||||
|
||||
private Limiter(int maxAvailableTokens, FiniteDuration tokenRefreshPeriod,
|
||||
private Limiter(int maxAvailableTokens, Duration tokenRefreshPeriod,
|
||||
int tokenRefreshAmount) {
|
||||
this.maxAvailableTokens = maxAvailableTokens;
|
||||
this.tokenRefreshPeriod = tokenRefreshPeriod;
|
||||
|
|
@ -162,7 +162,7 @@ public class RecipeGlobalRateLimit extends RecipeTest {
|
|||
|
||||
{
|
||||
// Use a large period and emulate the timer by hand instead
|
||||
ActorRef limiter = system.actorOf(Limiter.props(2, new FiniteDuration(100, TimeUnit.DAYS), 1), "limiter");
|
||||
ActorRef limiter = system.actorOf(Limiter.props(2, Duration.ofDays(100), 1), "limiter");
|
||||
|
||||
final Iterator<String> e1 = new Iterator<String>() {
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue