当我尝试编译以下代码时
import play.api._
import play.api.mvc._
import scala.collection.mutable.StringBuilder
import net.fyrie.redis.RedisClient
import net.fyrie.redis.RedisClientConfig
//import akka.dispatch._
//import akka.dispatch.Future
object Application extends Controller {
// val rd: RedisClient = new RedisClient("localhost", 6379, new RedisClientConfig(1, true, true, 50 to 100))(akka.actor.ActorSystem.create)
val rd = RedisClient.apply("localhost", 6379, new RedisClientConfig(1, true, true, 50 to 100))(akka.actor.ActorSystem.create)
def nonblocktest(application: String, platform: String) = Action {
val future: akka.dispatch.Future[Option[akka.util.ByteString]] = rd.get(StringBuilder.newBuilder.append(application).append('-').append(platform).toString)
future onSuccess {
case x => Ok(x.get.toString)
} onFailure {
case t: Throwable => Results.NoContent
}
Results.NoContent
}
}
我收到以下错误
sbt.PlayExceptions$CompilationException: Compilation error[package dispatch contains object and package with same name: japi
one of them needs to be removed from classpath]
at sbt.PlayReloader$$anon$2$$anonfun$reload$2$$anonfun$apply$15$$anonfun$apply$16.apply(PlayReloader.scala:349) ~[na:na]
at sbt.PlayReloader$$anon$2$$anonfun$reload$2$$anonfun$apply$15$$anonfun$apply$16.apply(PlayReloader.scala:349) ~[na:na]
at scala.Option.map(Option.scala:133) ~[scala-library.jar:na]
at sbt.PlayReloader$$anon$2$$anonfun$reload$2$$anonfun$apply$15.apply(PlayReloader.scala:349) ~[na:na]
at sbt.PlayReloader$$anon$2$$anonfun$reload$2$$anonfun$apply$15.apply(PlayReloader.scala:346) ~[na:na]
at scala.Option.map(Option.scala:133) ~[scala-library.jar:na]
如果我取消注释最后两个导入中的任何一个,我会得到相同的结果。我正在尝试在 play framework 2.1.0 中将 fyrie 用于 scala 2.10.0。我的目标是针对 sedis(阻塞)测试 fyrie 非阻塞异步调用的性能。那么我做错了什么?了解自己这可能是非常(非常)愚蠢的事情。
谢谢你的帮助。