[英]Actor Exception
I just want to send some messages between 2 actors in Groovy. 我只想在Groovy的2位演员之间发送一些消息。
I receive the first messages abc
, but get then the following exception: 我收到第一条消息
abc
,但收到以下异常:
An exception occurred in the Actor thread Actor Thread 1
Actor线程Actor线程1中发生异常
groovy.lang.MissingPropertyException: No such property: act1 for class: groovyx.gpars.actor.DefaultActorgroovy.lang.MissingPropertyException:否这样的属性:class groovyx.gpars.actor.DefaultActor的act1
Here is my code: 这是我的代码:
import static groovyx.gpars.actor.Actors.actor
def act2 = actor {
react {
println it
act1.send "def"
}
}
def act1 = actor {
act2.send 'abc'
react { println it }
}
[act1, act2]*.join()
Try doing 尝试做
def act1, act2
At the top of your script after the import statement 在导入语句之后,在脚本顶部
Then remove the 2 def
keywords you currently have 然后删除您当前拥有的2个
def
关键字
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.