RFR: 6988220: java.lang.ObjectName use of String.intern() causes major performance issues at scale

Frederic Parain frederic.parain at oracle.com
Fri Feb 24 09:13:43 UTC 2012

On 2/23/12 7:46 PM, David Schlosnagle wrote:
> Was the main bottleneck the contention on the interned string pool
> that prevented concurrent addition of ObjectNames? Are there other
> places within the JDK where use of intern() should be analyzed for
> similar scalability bottlenecks? I'm also curious what the heap
> implications are of no longer using interned strings.

I haven't looked for similar use of intern() within the JDK.
However, the scalability issue of String.intern() is known for
a long term, but the fix is not that simple, as Keith explained,
this is why it has been delayed for a long time due to other
higher priority tasks.

> A minor nit is that the equals method could be simplified slightly,
> making it more clear that the canonical names must match for equality:
> @Override
> public boolean equals(Object object)  {
>      // same object case
>      if (this == object) return true;
>      // object is not an object name case
>      if (!(object instanceof ObjectName)) return false;
>      ObjectName on = (ObjectName) object;
>      return _canonicalName.equals(on._canonicalName);
> }



Frederic Parain - Oracle
Grenoble Engineering Center - France
Phone: +33 4 76 18 81 17
Email: Frederic.Parain at oracle.com

More information about the core-libs-dev mailing list