RFR 8010182: Thread safety of Thread get/setName()
David Holmes
david.holmes at oracle.com
Tue May 21 06:43:00 UTC 2013
On 21/05/2013 4:32 PM, Florian Weimer wrote:
> On 05/21/2013 07:07 AM, Mike Duigou wrote:
>> Since the char array is never modified it could use the String(char[],
>> boolean) constructor. This has advantages for cases such as logging
>> which may read the thread name very many times.
>
> Couldn't we store the original string instead?
We can't** use a String instead of the char[] because of interaction
from the VM with JNI attached threads.
Do you mean we should store the String as well? That would add to the
memory footprint at a time when we are looking a reducing memory
footprint (ala class instance size reductions).
David
-----
** rather we won't. There is a lot of history here and using a String is
not impossible, but not worth the churn.
More information about the core-libs-dev
mailing list