add ActorRef.noSender() for the Java API, see #3429
- Actor.noSender is not accessible from Java, but it was in 2.1 so don’t remove - replaced all “null” in doc tests with ActorRef.noSender()
This commit is contained in:
parent
6c96485b26
commit
a2a646af4e
24 changed files with 92 additions and 79 deletions
|
|
@ -24,8 +24,8 @@ public class EchoServer {
|
|||
final ActorRef watcher = system.actorOf(Props.create(Watcher.class, latch), "watcher");
|
||||
final ActorRef nackServer = system.actorOf(Props.create(EchoManager.class, EchoHandler.class), "nack");
|
||||
final ActorRef ackServer = system.actorOf(Props.create(EchoManager.class, SimpleEchoHandler.class), "ack");
|
||||
watcher.tell(nackServer, null);
|
||||
watcher.tell(ackServer, null);
|
||||
watcher.tell(nackServer, ActorRef.noSender());
|
||||
watcher.tell(ackServer, ActorRef.noSender());
|
||||
latch.await(10, TimeUnit.MINUTES);
|
||||
} finally {
|
||||
system.shutdown();
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public class MessageStage extends
|
|||
if (cmd instanceof PipelineTest.SetTarget) {
|
||||
target = ((PipelineTest.SetTarget) cmd).getRef();
|
||||
} else if (cmd instanceof TickGenerator.Tick && target != null) {
|
||||
target.tell(cmd, null);
|
||||
target.tell(cmd, ActorRef.noSender());
|
||||
}
|
||||
//#omitted
|
||||
if (cmd instanceof TickGenerator.Tick) {
|
||||
|
|
|
|||
|
|
@ -72,12 +72,12 @@ public class PipelineTest {
|
|||
|
||||
@Override
|
||||
public void onCommand(ByteString cmd) throws Throwable {
|
||||
commandHandler.tell(cmd, null);
|
||||
commandHandler.tell(cmd, ActorRef.noSender());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(Message evt) throws Throwable {
|
||||
eventHandler.tell(evt, null);
|
||||
eventHandler.tell(evt, ActorRef.noSender());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -127,9 +127,9 @@ public class PipelineTest {
|
|||
final ActorRef proc = system.actorOf(Props.create(
|
||||
P.class, this, getRef(), getRef()), "processor");
|
||||
expectMsgClass(TickGenerator.Tick.class);
|
||||
proc.tell(msg, null);
|
||||
proc.tell(msg, ActorRef.noSender());
|
||||
final ByteString encoded = expectMsgClass(ByteString.class);
|
||||
proc.tell(encoded, null);
|
||||
proc.tell(encoded, ActorRef.noSender());
|
||||
final Message decoded = expectMsgClass(Message.class);
|
||||
assert msg == decoded;
|
||||
|
||||
|
|
@ -140,13 +140,13 @@ public class PipelineTest {
|
|||
expectMsgClass(TickGenerator.Tick.class);
|
||||
}
|
||||
};
|
||||
proc.tell("fail!", null);
|
||||
proc.tell("fail!", ActorRef.noSender());
|
||||
new Within(Duration.create(1700, TimeUnit.MILLISECONDS),
|
||||
Duration.create(3, TimeUnit.SECONDS)) {
|
||||
protected void run() {
|
||||
expectMsgClass(TickGenerator.Tick.class);
|
||||
expectMsgClass(TickGenerator.Tick.class);
|
||||
proc.tell(PoisonPill.getInstance(), null);
|
||||
proc.tell(PoisonPill.getInstance(), ActorRef.noSender());
|
||||
expectNoMsg();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import java.util.Collections;
|
|||
import scala.concurrent.duration.Deadline;
|
||||
import scala.concurrent.duration.FiniteDuration;
|
||||
import scala.util.Either;
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.ActorSystem;
|
||||
import akka.io.AbstractPipePair;
|
||||
import akka.io.PipePair;
|
||||
|
|
@ -74,7 +75,8 @@ public class TickGenerator<Cmd, Evt> extends
|
|||
@Override
|
||||
public Iterable<Either<Evt, Cmd>> onManagementCommand(Object cmd) {
|
||||
if (cmd == trigger) {
|
||||
ctx.getContext().self().tell(new Tick(Deadline.now().time()), null);
|
||||
ctx.getContext().self().tell(new Tick(Deadline.now().time()),
|
||||
ActorRef.noSender());
|
||||
schedule();
|
||||
}
|
||||
return Collections.emptyList();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue