Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Akka Scheduler, error with time unit

Tags:

scala

akka

I am trying to send actor a postponed message. Thus I use the Scheduler, getting a code example 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... Deleting the 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 do not see the point here.

like image 449
wipman Avatar asked Dec 20 '22 12:12

wipman


1 Answers

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

import scala.concurrent._

This does not give you the duration implicits. You need to also import those:

import scala.concurrent.duration._

The actual implicits you want are on scala.concurrent.duration.DurationInt

like image 187
Dylan Avatar answered Jan 06 '23 11:01

Dylan