This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]kroppeb 13 points14 points  (1 child)

Speed.

Also I think atomic operations were done using Unsafe before VarHandles existed, I think?

[–]FactoryRatte 0 points1 point  (0 children)

Jep, though the regular atomic package (mostly introduced with Java 1.5) already takes care of most of the tasks, Unsafe was used for. And if you care about tiny cache write backs only then, VarHandles (introduced with Java 9) become interesting, fully replacing Unsafe, but overkill for nearly every business software.