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
Async { | |
Logger.debug(s"Start $duration second wait") | |
Akka.system.scheduler.scheduleOnce(duration seconds){ | |
val blocker = Future { duration } | |
blocker map { duration => | |
Logger.debug(s"Finished $duration second wait") | |
Ok(duration.toString) | |
} | |
} | |
} |
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
SLF4J: Class path contains multiple SLF4J bindings. | |
SLF4J: Found binding in [jar:file:/Users/jamie/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.0.0.jar!/org/slf4j/impl/StaticLoggerBinder.class] | |
SLF4J: Found binding in [jar:file:/Users/jamie/.ivy2/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] | |
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. | |
13:31:11.616 [consoletest-akka.actor.default-dispatcher-1] INFO a.a.t.Slf4jTraceContextEventHandler - Slf4jEventHandler started | |
13:31:11.620 [consoletest-akka.actor.default-dispatcher-2] DEBUG akka.event.EventStream - logger log1-Slf4jTraceContextEventHandler started | |
13:31:11.620 [consoletest-akka.actor.default-dispatcher-2] DEBUG akka.event.EventStream - Default Loggers started | |
13:31:11.639 [consoletest-akka.actor.default-dispatcher-4] INFO o.j.c.Bootstrap$$anonfun$5$$anon$1 - **** Starting balance retrieval **** | |
13:31:11.672 [consoletest-akka.actor.default-dispatc |
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 org.jamieallen.consoletest | |
import akka.util.duration._ | |
import akka.actor._ | |
import akka.dispatch.ExecutionContext | |
import akka.dispatch.Promise | |
import java.util.concurrent.TimeoutException | |
import akka.dispatch.Await | |
import akka.pattern.pipe |
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
scalaVersion := "2.9.2" | |
name := "Console Playground" | |
scalacOptions ++= Seq("-unchecked", "-deprecation", "-optimize") | |
resolvers ++= Seq("akka-snapshots" at "http://repo.akka.io/snapshots", | |
"akka-releases" at "http://repo.akka.io/releases", | |
"Atmos Repo" at "http://repo.typesafe.com/typesafe/atmos-releases", | |
"Cloudera Repo" at "https://repository.cloudera.com/content/groups/public", |
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.actor._ | |
import akka.pattern.ask | |
import akka.util._ | |
import akka.util.duration._ | |
import scala.util.control.Exception._ | |
/** | |
* To test, execute this code and use this command in a shell: "telnet localhost 8080" | |
* At the prompt, type in numbers and press enter, and they will be accumulated, returning | |
* the total value each time. |
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 scala.annotation.switch | |
/** | |
* Simple test of how quickly Scala can perform typed pattern matches, both of primitive types and complex object types. | |
*/ | |
object PatternMatchRunner extends App { |
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
name := "Akka ActorSystem Test" | |
version := "1.0" | |
scalaVersion := "2.9.1-1" | |
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/" | |
libraryDependencies += "com.typesafe.akka" % "akka-actor" % "2.0.1" |
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 scala.annotation.switch | |
/** | |
* Simple test of how quickly Scala can perform typed pattern matches, both of primitive types and complex object types. | |
*/ | |
object PatternMatchRunner extends App { | |
val numberOfOperations = 10000000 |
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 scala.annotation.switch | |
/** | |
* Simple test of how quickly Scala can perform typed pattern | |
* matches, both of primitive types and complex object types. | |
*/ | |
object PatternMatchTest extends App { | |
val numberOfOperations = 10000000 | |
println("Performing baseline test...") |
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
/** | |
* I'm trying to create a basic supervisor hierarchy with four actors. If any fail for | |
* any reason, tear them all down and restart them to re-process any unhandled | |
* data. When I run, I see the "Blowing up!" log output. I expect the ensuing throw | |
* to blow up my actors, and then I should see all of my actors restarted per my | |
* supervision strategy, but I just get a message timeout (None response to the | |
* producer). | |
* | |
* The online Akka docs say this about sending a message with a ?: "The receiving | |
* actor should reply to this message, which will complete the future with the |