Created
December 23, 2015 14:28
-
-
Save chuwy/622b9ca9934e822e0000 to your computer and use it in GitHub Desktop.
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.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.model._ | |
import akka.stream.ActorMaterializer | |
import akka.stream.scaladsl.{ Sink, Source, Flow } | |
import com.typesafe.config.ConfigFactory | |
import scala.concurrent.{ Future, Await, ExecutionContext } | |
import scala.concurrent.duration._ | |
import org.joda.time.DateTime | |
implicit val system: ActorSystem = ActorSystem("mysystem", ConfigFactory.parseString("akka.daemonic=on")) | |
implicit val context: ExecutionContext = system.dispatcher | |
implicit val materializer = ActorMaterializer() | |
val http = Http() | |
def foo = { | |
try { Await.result(http.singleRequest(HttpRequest(uri = "http://akka.io")), 3.second) } | |
catch { case e => println(e) } | |
println(new DateTime().getMillis) | |
} | |
var i = 0 | |
while (i < 50) { foo; i = i + } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment