One well-known source has cited that a synchronized method call is as much as 50 times slower than an unsynchronized method call.
一个著名的资料来源就曾经引证说一个同步的方法调用比一个非同步的方法调用慢50倍。
Even when a program contains only a single thread running on a single processor, a synchronized method call is still slower than an unsynchronized method call.
即使一个程序只包括一个在单一处理器上运行的单线程,一个同步的方法调用仍要比非同步的方法调用慢。
As more advanced JVMs have emerged, the cost of synchronization has decreased, but there is still a performance penalty for entering and leaving a synchronized method or block.
随着更高级的JVM的出现,同步的代价降低了,但出入synchronized方法或块仍然有性能损失。
At a later point in time, the reader thread invokes the read operation on the channel (this is also a synchronized method, so the reader thread must acquire the monitor lock before proceeding).
稍后,阅读器线程调用通道上的read操作(这也是一个同步的方法,所以阅读器线程在继续处理之前必须得到监视器锁)。
For example, suppose an object provides a synchronized method that often takes a long time to return.
比如,假如有一个同步方法通常需要很长时间才返回。
Methods that are not synchronized may still execute at any time, even if a synchronized method is in progress.
如果一个同步方法正在执行中,其他的非同步方法也可以在任何时候执行。
A lock is acquired on entry to a synchronized method or block, and released on exit, even if the exit occurs due to an exception.
当进入一个同步方法或同步块的时候必须获得该锁,而退出的时候(即使是异常退出)必须释放这个锁。
With the exception of enumerators, all regular expression classes are thread safe or can be converted into thread-safe objects by a synchronized method.
除枚举数之外,所有正则表达式类都是线程安全的或者可以通过同步方法转换成线程安全对象。
When a thread invokes a synchronized method, it automatically acquires the intrinsic lock for that method's object and releases it when the method returns.
当一个线程调用一个同步方法时,它自动请求此方法的内部锁,并在方法返回时释放。
When a thread invokes a synchronized method, it automatically acquires the intrinsic lock for that method's object and releases it when the method returns.
当一个线程调用一个同步方法时,它自动请求此方法的内部锁,并在方法返回时释放。
应用推荐