Packing 2 data points into 1 field in ThreadPoolExecutor

Alex Yursha alex.yursha at
Mon Dec 1 17:36:11 UTC 2014

Thanks a lot.

Seems like i need to look deeper into the JVM and hardware intrinsics to understand some pecularities of core libs class designs.

Sent from my iPhone

> On Dec 1, 2014, at 20:27, Vitaly Davidovich <vitalyd at> wrote:
> It allows to manipulate two (related) bits of info atomically without needing a lock and when efficient double CAS is not available (which it isn't on supported archs).
> Sent from my phone
>> On Dec 1, 2014 12:23 PM, "Alex Yursha" <alexyursha at> wrote:
>> Hi all,
>> According to javadoc current implementation of ThreadPoolExecutor packs two conceptual fields ‘workerCount’ and ‘runState’ into one actual field ‘ctl’ of type AtomicInteger.
>> Could you please explain are there any performance or other benefits for this? It seems to complicate the class design and I can’t find the positive side of this.
>> Thanks,
>> Alex

More information about the core-libs-dev mailing list