我有以下 Groovy 代码:
abstract class Actor extends Script {
synchronized void proceed() {
this.notify()
}
synchronized void pause() {
wait()
}
}
class MyActor extends Actor {
def run() {
println "hi"
pause()
println "hi again"
}
}
def theactor = new MyActor()
theactor.run()
theactor.proceed()
当我运行代码时,我希望代码输出“hi”和“hi again”。相反,它只是停在“hi”并卡在 pause() 函数上。关于如何继续该计划的任何想法?