Akka Scheduler, time unit error

I am trying to send a delayed message to an actor. So I am using Scheduler

getting sample code from http://doc.akka.io/docs/akka/2.1.0/scala/scheduler.html .

[error] /home/zeus/terra/src/main/scala/hw.scala:55: value milliseconds is not a member of Int
[error]         50 milliseconds,
[error]            ^
[error] one error found
[error] (compile:compile) Compilation failed
[error] Total time: 3 s, completed Aug 11, 2014 4:07:48 PM

      

Surprisingly this error occured ... After removing milliseconds

from my code another error appeared:

[error] /home/vador/death_star/src/main/scala/hw.scala:55: type mismatch;
[error]  found   : Int(50)
[error]  required: scala.concurrent.duration.FiniteDuration
[error]         50,
[error]         ^
[error] one error found
[error] (compile:compile) Compilation failed
[error] Total time: 3 s, completed Aug 11, 2014 4:12:32 PM

      

I don't see the point here.

+3


source to share


1 answer


Based on the comments, @Ende Neu was probably on the right track.

import scala.concurrent._

      

It doesn't give you duration. You also need to import those:



import scala.concurrent.duration._

      

The actual values ​​you want are on scala.concurrent.duration.DurationInt

+7


source







All Articles