improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
This commit is contained in:
parent
3617fe8b41
commit
4bd6b7aab1
157 changed files with 3290 additions and 8882 deletions
|
|
@ -28,7 +28,7 @@ public class ParentChildTest {
|
|||
|
||||
//#test-example
|
||||
static class Parent extends UntypedActor {
|
||||
final ActorRef child = context().actorOf(Props.create(Child.class), "child");
|
||||
final ActorRef child = getContext().actorOf(Props.create(Child.class), "child");
|
||||
boolean ponged = false;
|
||||
|
||||
@Override public void onReceive(Object message) throws Exception {
|
||||
|
|
@ -45,7 +45,7 @@ public class ParentChildTest {
|
|||
static class Child extends UntypedActor {
|
||||
@Override public void onReceive(Object message) throws Exception {
|
||||
if ("ping".equals(message)) {
|
||||
context().parent().tell("pong", self());
|
||||
getContext().parent().tell("pong", self());
|
||||
} else {
|
||||
unhandled(message);
|
||||
}
|
||||
|
|
@ -79,7 +79,7 @@ public class ParentChildTest {
|
|||
boolean ponged = false;
|
||||
|
||||
public DependentParent(Props childProps) {
|
||||
child = context().actorOf(childProps, "child");
|
||||
child = getContext().actorOf(childProps, "child");
|
||||
}
|
||||
|
||||
@Override public void onReceive(Object message) throws Exception {
|
||||
|
|
@ -102,7 +102,7 @@ public class ParentChildTest {
|
|||
|
||||
public GenericDependentParent(Function<ActorRefFactory, ActorRef> childMaker)
|
||||
throws Exception {
|
||||
child = childMaker.apply(context());
|
||||
child = childMaker.apply(getContext());
|
||||
}
|
||||
|
||||
@Override public void onReceive(Object message) throws Exception {
|
||||
|
|
@ -175,13 +175,13 @@ public class ParentChildTest {
|
|||
|
||||
@Override public Actor create() throws Exception {
|
||||
return new UntypedActor() {
|
||||
final ActorRef child = context().actorOf(Props.create(Child.class), "child");
|
||||
final ActorRef child = getContext().actorOf(Props.create(Child.class), "child");
|
||||
|
||||
@Override public void onReceive(Object x) throws Exception {
|
||||
if (sender().equals(child)) {
|
||||
proxy.ref().forward(x, context());
|
||||
proxy.ref().forward(x, getContext());
|
||||
} else {
|
||||
child.forward(x, context());
|
||||
child.forward(x, getContext());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue