jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
equal
deleted
inserted
replaced
40 import java.security.AccessController; |
40 import java.security.AccessController; |
41 import java.security.PrivilegedActionException; |
41 import java.security.PrivilegedActionException; |
42 import java.security.PrivilegedExceptionAction; |
42 import java.security.PrivilegedExceptionAction; |
43 import java.util.function.IntBinaryOperator; |
43 import java.util.function.IntBinaryOperator; |
44 import java.util.function.IntUnaryOperator; |
44 import java.util.function.IntUnaryOperator; |
|
45 import jdk.internal.misc.Unsafe; |
45 import jdk.internal.reflect.CallerSensitive; |
46 import jdk.internal.reflect.CallerSensitive; |
46 import jdk.internal.reflect.Reflection; |
47 import jdk.internal.reflect.Reflection; |
47 |
48 |
48 /** |
49 /** |
49 * A reflection-based utility that enables atomic updates to |
50 * A reflection-based utility that enables atomic updates to |
148 * @since 1.6 |
149 * @since 1.6 |
149 */ |
150 */ |
150 public abstract void lazySet(T obj, int newValue); |
151 public abstract void lazySet(T obj, int newValue); |
151 |
152 |
152 /** |
153 /** |
153 * Gets the current value held in the field of the given object managed |
154 * Returns the current value held in the field of the given object |
154 * by this updater. |
155 * managed by this updater. |
155 * |
156 * |
156 * @param obj An object whose field to get |
157 * @param obj An object whose field to get |
157 * @return the current value |
158 * @return the current value |
158 */ |
159 */ |
159 public abstract int get(T obj); |
160 public abstract int get(T obj); |
365 /** |
366 /** |
366 * Standard hotspot implementation using intrinsics. |
367 * Standard hotspot implementation using intrinsics. |
367 */ |
368 */ |
368 private static final class AtomicIntegerFieldUpdaterImpl<T> |
369 private static final class AtomicIntegerFieldUpdaterImpl<T> |
369 extends AtomicIntegerFieldUpdater<T> { |
370 extends AtomicIntegerFieldUpdater<T> { |
370 private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe(); |
371 private static final Unsafe U = Unsafe.getUnsafe(); |
371 private final long offset; |
372 private final long offset; |
372 /** |
373 /** |
373 * if field is protected, the subclass constructing updater, else |
374 * if field is protected, the subclass constructing updater, else |
374 * the same as tclass |
375 * the same as tclass |
375 */ |
376 */ |