#22903 Fix code snippeds

* move scala and java sources out of paradox sources
* replace relative paths with $code$ and $akka$
* fix broken includes
This commit is contained in:
Martynas Mickevičius 2017-05-11 11:59:28 +03:00
parent 7bee495749
commit 81df4ff417
384 changed files with 1609 additions and 1602 deletions

View file

@ -0,0 +1,37 @@
package jdocs.io.japi;
import java.util.concurrent.CountDownLatch;
import akka.actor.ActorRef;
import akka.actor.Terminated;
import akka.actor.AbstractActor;
public class Watcher extends AbstractActor {
static public class Watch {
final ActorRef target;
public Watch(ActorRef target) {
this.target = target;
}
}
final CountDownLatch latch;
public Watcher(CountDownLatch latch) {
this.latch = latch;
}
@Override
public Receive createReceive() {
return receiveBuilder()
.match(Watch.class, msg -> {
getContext().watch(msg.target);
})
.match(Terminated.class, msg -> {
latch.countDown();
if (latch.getCount() == 0) getContext().stop(getSelf());
})
.build();
}
}