Duplicate :
|
|
Relates :
|
|
Relates :
|
As described in JDK-8227006 the addition of container support has slowed down the execution of Runtime.availableProcessors. By calling this function in its spin-loop waitingGet() can also suffer from a severe slowdown in performance. spins = (Runtime.getRuntime().availableProcessors() > 1) ? 1 << 8 : 0; // Use brief spin-wait on multiprocessors As we only care about >1 processors we can cache this value in a field. The only problem case would be a >1 to 1 transition which is an unlikely change. If it did occur it would only result in a small performance hit anyway. This fix is only needed for 8u as 9 and later have different code due to JDK-8157522