一般而言,在保证线程安全的前提下要尽可能地简化同步语句。
In general, strive to make your synchronized blocks as lean as possible, without harming thread safety.
应用程序可以使用Ajax实现自动保存,但前提是表单应提供传统的提交按钮或使用同步请求发送数据以做处理。
Applications can use Ajax for auto-saving, but your forms should either provide good old submit buttons or use synchronous requests for sending the data for processing.
从表面上看,锁省略似乎可以允许我们不必忍受同步带来的负担,就可以编写线程安全的代码了,前提是在同步的确是多余的情况下。
On the surface it looks as though lock elision allows us to write thread safe code without any synchronization penalty for using in cases where it really wasn't needed.
应用推荐