Last active
August 29, 2015 14:06
-
-
Save rssh/93a7214c276a64da7551 to your computer and use it in GitHub Desktop.
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 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) | |
} | |
} | |
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
Illustrate strange problem with scheduler, looks like one is not stated without actors.