Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8333172

Document a recommendation to use VarHandles instead of java.util.concurrent.atomic.*FieldUpdater

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • None
    • core-libs
    • None

      *FieldUpdaters were introduced as a means to achieve high performance atomic field access without having to wrap all fields in the AtomicReference and friends, alas the FieldUpdaters always competed with direct Unsafe usage to achieve optimal performance.

      With the introduction of VarHandles, and the recent work in minimizing the usage of Unsafe, we should add at the top of each FieldUpdater type the recommendation to instead use VarHandles. Such a recommendation should include a clear and brief example of how that would look, as to make adoption of VarHandles more straight forward.

            Unassigned Unassigned
            vklang Viktor Klang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: