我正试图Futures在akka中摸索并询问模式.
所以,我制作了两个演员,一个要求另一个演员给他发回信息.好吧,根据akka的Futures文档,演员应该询问(?)消息,它应该给他一个Future实例.然后演员应该阻止(使用Await)获得Future结果.
好吧,我永远不会完成我的未来.这是为什么?
代码是:
package head_thrash
import akka.actor._
import akka.util.Timeout
import scala.concurrent.Await
import scala.concurrent.duration._
object Main extends App {
val system = ActorSystem("actors")
val actor1 = system.actorOf(Props[MyActor], "node_1")
val actor2 = system.actorOf(Props[MyActor], "node_2")
actor2 ! "ping_other"
system.awaitTermination()
Console.println("Bye!")
}
class MyActor extends Actor with ActorLogging {
import akka.pattern.ask
implicit val timeout = Timeout(100.days)
def receive = {
case "ping_other" => {
val selection = context.actorSelection("../node_1")
log.info("Sending …Run Code Online (Sandbox Code Playgroud) 当前版本的java(8u20,7u67)打破了gradle\groovy编译器和运行时兼容性:
:compileTestGroovy FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestGroovy'.
> Bad <init> method call from inside of a branch
Exception Details:
Location:
some/MyClass.<init>(Lsome/MyOtherClass;)V @71: invokespecial
Reason:
Error exists in the bytecode
Bytecode:
0x0000000: b800 174d 04bd 0019 5903 2b53 5910 ff12
0x0000010: 05b8 001f 2a5f ab00 0000 0055 0000 0003
0x0000020: f20b c677 0000 0022 0000 9b75 0000 0037
0x0000030: 2cce be6d 0000 0040 5f5a 5903 3212 05b8
0x0000040: 0023 c000 …Run Code Online (Sandbox Code Playgroud) 为什么 gradle 不在所有定义的 Maven 存储库中搜索依赖项?
回购块定义:
repositories {
maven {
name = 'JBoss.org Maven repository'
url 'https://repository.jboss.org/nexus/content/groups/public'
}
maven {
name = 'spring-milestones'
url 'http://repo.springsource.org/libs-milestone/'
}
mavenCentral()
}
Run Code Online (Sandbox Code Playgroud)
(假设我在子项目中的某个地方net.sf.json-lib:json-lib:2.2.1)我收到:
* What went wrong:
Could not resolve all dependencies for configuration ':myproject:compileClasspath'.
> Could not find json-lib.jar (net.sf.json-lib:json-lib:2.2.1).
Searched in the following locations:
http://repo.springsource.org/libs-milestone/net/sf/json-lib/json-lib/2.2.1/json-lib-2.2.1.jar
Run Code Online (Sandbox Code Playgroud)
为什么只有一个搜索位置?该json-lib清楚地存在mavenCentral()。
有没有办法对其进行分析或以某种方式进行调试?
PS,如果我mavenCentral()在 repos 列表中向上移动一个位置,我可以解决这个问题,但这将由于相同的原因破坏另一个子项目依赖项解析——来自“spring”repo 的某些东西在mavenCentral().
我使用 gradle (v1.10) 中的应用程序插件来打包和运行我的应用程序。
所以,现在我需要使用方面(aspectj),并且我不想使用方面j编译器(ajc)。
是否可以调整 gradle 应用程序运行脚本,以便我的应用程序可以通过加载时编织来运行?比如提供 jvm 选项:
-javaagent:_path_to_aspectj_weaver.jar
gradle ×3
akka ×1
aspectj ×1
asynchronous ×1
build-system ×1
future ×1
groovy ×1
javaagents ×1
jvm ×1
maven ×1
scala ×1
verifyerror ×1