📄 synchronizedbytecodebug.groovy
字号:
/** * @author Guillaume Laforge */class SynchronizedBytecodeBug extends GroovyTestCase { /** * Groovy's bytecode associated with syncrhonized(foo) construct used to generate invalid bytecode * This test method shows that the standard wait()/notify() works. */ void testSynchronized() { Integer foo = 0 Thread.start{ println "sleeping for a moment" sleep 1000 println "slept and synchronizing from thread" synchronized(foo) { println "notifying" foo.notify() println "notified" } } println "synchronizing" synchronized(foo) { println "starting to wait" foo.wait() println "waited" } // if this point is reached, the test worked :-) assert true }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -