classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: StringBuilder


From: David Holmes
Subject: RE: StringBuilder
Date: Mon, 20 Dec 2004 08:52:30 +1000

Jeroen,

If this is for Java 5.0 support then rewrite StringBuilder to use Atomics.

I'm obviously missing some context for this however. Is the char[] really
shared that often in practice with StringBuffer ?

David Holmes

> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden Behalf Of
> Jeroen Frijters
> Sent: Friday, 17 December 2004 10:51 PM
> To: address@hidden; address@hidden
> Subject: StringBuilder
>
>
> Hi,
>
> Attached is an example of how StringBuilder could be made thread safe
> and still enable sharing the char[]. Unfortunately it requires
> allocating an extra temp object and JIT magic, but maybe someone is
> interested in pursuing this (I'm not because I have to special case
> StringBuilder in another way).
>
> Note that you could also get rid of the temporary object by using a
> String instance for this, but that would require making the value and
> count fields of String non-final and this has memory model consequences
> as well (thereby making String non-portable).
>
> Regards,
> Jeroen
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]