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 agent | |
import akka.agent.Agent | |
import akka.stm._ | |
object AgentStmSample { | |
def transfer(from: Agent[Int], to: Agent[Int], amount: Int): Boolean = { | |
atomic { | |
if (from.get < amount) false |
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 sample | |
import akka.actor.Actor | |
import akka.actor.Props | |
import akka.dispatch.Await | |
import akka.util.duration._ | |
import akka.util.Timeout | |
import akka.actor.ActorRef | |
import akka.actor.Terminated | |
import akka.actor.ActorSystem |
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 akka.config.bean | |
import java.util.{ List ⇒ JList } | |
import java.util.{ ArrayList ⇒ JArrayList } | |
import java.util.{ HashMap ⇒ JHashMap } | |
import scala.reflect.BeanProperty | |
import com.typesafe.config.Config | |
import com.typesafe.config.ConfigFactory | |
class AkkaConfigBean { |
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
case object Run | |
case object Msg | |
class Destination extends Actor { | |
def receive = { | |
case Msg ⇒ sender ! Msg | |
} | |
} | |
class Client( |
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
#!/bin/sh | |
# Run the benchmark with this as sbt start script, | |
# but change the paths (/home/nordwall) | |
# ~/bin/sbt-benchmark.sh | |
# > project akka-actor-tests | |
# > test-only akka.performance.microbench.TellThroughputPerformanceSpec | |
export JAVA=/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java | |
export FLAGS="-server -Dfile.encoding=UTF8 -XX:+UseNUMA -XX:+UseCondCardMark -XX:-UseBiasedLocking" |
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
case object Run | |
case object Msg | |
class Destination extends Actor { | |
def receive = { | |
case Msg ⇒ sender ! Msg | |
} | |
} | |
class Client( |
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 question | |
import java.io.IOException | |
import scala.util.Random | |
import akka.actor.Actor | |
import akka.actor.ActorRef | |
import akka.actor.ActorSystem | |
import akka.actor.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
package akka.cluster | |
import com.typesafe.config.ConfigFactory | |
import akka.remote.testkit.MultiNodeConfig | |
import akka.remote.testkit.MultiNodeSpec | |
import akka.testkit._ | |
import akka.util.duration._ | |
import akka.cluster.MemberStatus._ | |
object ClusterDemoMultiJvmSpec extends MultiNodeConfig { |
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 perf | |
import akka.actor.ActorSystem | |
import akka.actor.Actor | |
import akka.actor.Props | |
import scala.concurrent.forkjoin.ThreadLocalRandom | |
import akka.routing.ConsistentHashingRouter | |
import akka.routing.ConsistentHashingRouter.ConsistentHashableEnvelope | |
import scala.util.Random | |
import akka.routing.Broadcast |
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 akka.pattern.CircuitBreaker | |
val breaker = | |
CircuitBreaker(system.scheduler, | |
maxFailures = 5, | |
callTimeout = 10.seconds, | |
resetTimeout = 1.minute) | |
def dangerous: Future[String] = | |
breaker.withCircuitBreaker(Future(dangerousCall)) |
OlderNewer