Skip to content

Instantly share code, notes, and snippets.

@chuwy
Created December 23, 2015 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuwy/622b9ca9934e822e0000 to your computer and use it in GitHub Desktop.
Save chuwy/622b9ca9934e822e0000 to your computer and use it in GitHub Desktop.
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