这是涉及akka的部分代码:
abstract class AkkaBaseClass[T <: AkkaClass1, U <: Loger] extends Actor {
protected val val1 = context.actorOf(Props[T])
protected val val2 = context.actorOf(Props[U])
def receive = {
case "test" => {
implicit val timeout = Timeout(Config.timeout seconds)
val future = val1 ? "request"
val result = Await.result(future, timeout.duration).asInstanceOf[List[ActorRef]]
sender ! result
}
case "log" => val2 ! "log"
}
class AkkaClass1 extends Actor { .... }
trait Loger extends Actor { ..... }
有2个错误:
No ClassTag available for T and No ClassTag available for U
但是T
andU
不是数组。我该怎么办?