私は次の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」と「hiagain」を出力させたいです。代わりに、「hi」で停止し、pause()関数でスタックします。プログラムを継続する方法について何かアイデアはありますか?