RFR: 8153334: Replace BufferedInputStreams use of AtomicReferenceFieldUpdater with Unsafe
Martin Buchholz
martinrb at google.com
Mon Apr 4 15:45:46 UTC 2016
On Sun, Apr 3, 2016 at 5:19 AM, Claes Redestad
<claes.redestad at oracle.com> wrote:
>> the patch is fine for me with the minor nitpick that the static final
>> containing Unsafe should be called UNSAFE and not just U.
>
>
> sure, I copied the setup/naming convention from ConcurrentHashMap, but
> UNSAFE does make it stand out better.
We adopted the U convention in java.util.concurrent because it makes
that performance-obsessed code read better.
> I think this one is going too far.
>
> A*FU/VarHandles should are supposed to act like a go-to replacement for
> Unsafe throughout the class library, and we want to shrink the Unsafe
> exposure. Also, I don't think removing A*FU in favor of Unsafe here wins
> us anything: there should be no throughput hit, and we *will* load A*FU
> down the road anyway, negating the startup wins.
>
> -Aleksey
It is surprising to see new uses of Unsafe when we have an ongoing
initiative within openjdk (especially from Paul Sandoz) to remove most
uses. Varhandles are coming and are expected to replace uses of
Unsafe in the JDK.
More information about the core-libs-dev
mailing list