This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (C) 2013 Typesafe Inc. <http://www.typesafe.com> | |
*/ | |
package akka.util | |
import java.util.concurrent.atomic.AtomicReferenceArray | |
import scala.annotation.tailrec | |
import scala.concurrent.ExecutionContext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (C) 2013 Typesafe Inc. <http://www.typesafe.com> | |
*/ | |
package docs.channels | |
import akka.actor.{ Actor, ActorSystem } | |
import akka.channels._ | |
import akka.util.Timeout | |
import scala.concurrent.duration._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final ActorRef child = getContext().actorOf(new Props( | |
new UntypedActorFactory() { | |
@Override public UntypedActor create() { | |
// getSender() will not yield what you think it should | |
return new OtherActor(getSender()); | |
} | |
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static SupervisorStrategy strategy = | |
new OneForOneStrategy(10, Duration.create("1 minute"), | |
new Function<Throwable, Directive>() { | |
@Override | |
public Directive apply(Throwable t) { | |
if (t instanceof ArithmeticException) { | |
return resume(); | |
} else if (t instanceof NullPointerException) { | |
log.warning("restarting misbehaving child"); | |
return restart(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isDownloading = false | |
// set up a scheduler to sync the registry | |
system.scheduler.schedule(0 millis, 3 hours) { | |
if(!isDownloading) { | |
system.actorOf(Props[Downloader]) ! Download | |
} | |
} | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package demo | |
class TopLevel extends Actor { | |
val db = context.actorOf(Props[Database]) | |
context.watch(db) | |
val web = context.actorOf(Props[WebServer]) | |
web ! Start(database = db) | |
override val supervisorStrategy = OneForOneStrategy() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
import sbt.Keys._ | |
import com.typesafe.sbt.SbtStartScript.{startScriptForClassesSettings => startScript} | |
import com.typesafe.sbt.SbtStartScript.StartScriptKeys._ | |
object AkkaProjectInScalaBuild extends Build { | |
lazy val akkaProjectInScala = Project( | |
id = "akka-project-in-scala", | |
base = file("."), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.TimeUnit; | |
import scala.concurrent.duration.Duration; | |
import akka.actor.ActorIdentity; | |
import akka.actor.ActorPath; | |
import akka.actor.ActorRef; | |
import akka.actor.Identify; | |
import akka.actor.ReceiveTimeout; | |
import akka.actor.Terminated; | |
import akka.actor.UntypedActorWithStash; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package rs | |
import org.openjdk.jmh.annotations._ | |
import org.reactivestreams.Publisher | |
import org.reactivestreams.Subscriber | |
import org.reactivestreams.Subscription | |
import java.util.concurrent.atomic.AtomicLong | |
import java.util.Queue | |
import java.util.concurrent.CountDownLatch | |
import java.util.concurrent.TimeUnit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rk:~ rkuhn$ tracert.pl youtube.com | |
traceroute: Warning: youtube.com has multiple addresses; using 173.194.113.136 | |
traceroute to youtube.com (173.194.113.136), 64 hops max, 52 byte packets | |
1 fritz.box (192.168.178.1 [PRIVATE-ADDRESS-CBLK-RFC1918-IANA-RESERVED]) 0.933 ms 0.772 ms 0.707 ms | |
2 213.191.89.55 (213.191.89.55 [HANSENET]) 25.085 ms 25.208 ms 25.241 ms | |
3 62.53.12.0 (62.53.12.0 [DE-MEDIAWAYS-970527]) 25.232 ms 25.375 ms 26.425 ms | |
4 ge8-0.br50.fra.de.hansenet.net (62.109.70.21 [DE-HANSENET-20010803]) 25.899 ms 25.569 ms 40.448 ms | |
5 de-cix10.net.google.com (80.81.192.108 [DE-CIX-FRA-IXP]) 26.053 ms 25.781 ms 25.564 ms | |
6 209.85.240.64 (209.85.240.64 [GOOGLE]) 34.697 ms 26.763 ms | |
209.85.241.110 (209.85.241.110 [GOOGLE]) 26.022 ms |