Skip to content

Instantly share code, notes, and snippets.

@rssh
Last active August 29, 2015 14:06
Show Gist options
  • Save rssh/93a7214c276a64da7551 to your computer and use it in GitHub Desktop.
Save rssh/93a7214c276a64da7551 to your computer and use it in GitHub Desktop.
package x
import akka.actor._
import scala.concurrent._
import scala.concurrent.duration._
import ExecutionContext.Implicits.global
object X
{
def main(args:Array[String]):Unit =
{
val actorSystem = ActorSystem.create("system")
val scheduler = actorSystem.scheduler
@volatile var x = 0
val s1 = scheduler.asInstanceOf[LightArrayRevolverScheduler]
System.err.println("wheel size="+s1.WheelSize)
System.err.println("tick-duration="+s1.TickDuration)
val cancelable = scheduler.schedule(100 milliseconds,500 milliseconds){
() => { System.err.println("Fun called."); x=x+1 }
}
Thread.sleep(3000)
System.err.println("after sleep")
actorSystem.shutdown()
assert(x>0)
}
}
@rssh
Copy link
Author

rssh commented Sep 8, 2014

Illustrate strange problem with scheduler, looks like one is not stated without actors.

@rssh
Copy link
Author

rssh commented Sep 9, 2014

rumor, that second argument in scheduler is call-by-name (not function) but for some reason named f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment