This file contains hidden or 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 ex1 | |
import akka.actor.{Actor, ActorSystem, Props} | |
import akka.pattern.{CircuitBreaker, ask, pipe} | |
import akka.util.Timeout | |
import ex1.CircuitBreakerActor.{Broken, BreakState, Ok} | |
import scala.concurrent.duration._ | |
import scala.concurrent.{Await, Future} | |
import scala.util.control.NonFatal |
This file contains hidden or 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 ex1 | |
import akka.actor.{Actor, ActorSystem, Props} | |
import akka.pattern.ask | |
import akka.util.Timeout | |
import scala.concurrent.duration._ | |
import scala.concurrent.{Await, Future} | |
object Main3 { |
This file contains hidden or 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 ex1 | |
import java.util.concurrent.atomic.AtomicInteger | |
import akka.actor._ | |
import akka.pattern.{Backoff, BackoffSupervisor} | |
import scala.concurrent.Await | |
import scala.concurrent.duration._ |
This file contains hidden or 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 com.example | |
import akka.actor._ | |
import akka.pattern._ | |
import com.example.DbActor.Message.{BlockingRequest, NonBlockingRequest, Result} | |
import scala.concurrent.{ExecutionContext, Future} | |
object BlockingNonBlockingSample { | |
def main(args: Array[String]): Unit = { |
This file contains hidden or 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.SupervisorStrategy.{Resume, Restart, Stop} | |
import akka.actor._ | |
object PreRestart extends App { | |
val system = ActorSystem() | |
try { | |
val actor = system.actorOf(Props[SupervisorExceptionActor2]) | |
actor ! 1 | |
actor ! 2 | |
actor ! 3 |
This file contains hidden or 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.SupervisorStrategy.{Resume, Restart, Stop} | |
import akka.actor._ | |
object Main extends App { | |
val system = ActorSystem() | |
try { | |
val actor = system.actorOf(Props[SupervisorExceptionActor]) | |
actor ! 1 | |
actor ! 2 | |
actor ! 3 |
This file contains hidden or 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.SupervisorStrategy.{Restart, Stop} | |
import akka.actor._ | |
object Main extends App { | |
val system = ActorSystem() | |
try { | |
val actor = system.actorOf(Props[SupervisorExceptionActor]) | |
actor ! 1 | |
actor ! 2 | |
} finally { |
This file contains hidden or 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
def cont1(request: Int): Cont[Unit, Int] = | |
Cont((f: Int => Unit) => { | |
println("add 1") | |
f(request + 1) | |
println("added 1") | |
}) | |
def cont2(request: Int): Cont[Unit, Int] = | |
Cont((f: Int => Unit) => { | |
println("add 2") |
This file contains hidden or 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
$ scalac -Xprint:typer Foo.scala | |
[[syntax trees at end of typer]] // Foo.scala | |
package <empty> { | |
object Main extends AnyRef with App { | |
def <init>(): Main.type = { | |
Main.super.<init>(); | |
() | |
}; | |
def foo(x: Option[Int]): Unit = x match { | |
case (x: Int)Some[Int]((a @ _)) => scala.this.Predef.println(a) |
This file contains hidden or 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure(2) do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at |