public void lazySet(T obj, int newValue) { if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj); unsafe.putOrderedInt(obj, offset, newValue); }
private void fullCheck(T obj) { if (!tclass.isInstance(obj)) throw new ClassCastException(); if (cclass != null) ensureProtectedAccess(obj); }
/** * Creates and returns an updater for objects with the given field. * The Class argument is needed to check that reflective types and * generic types match. * * @param tclass the class of the objects holding the field * @param fieldName the name of the field to be updated * @return the updater * @throws IllegalArgumentException if the field is not a * volatile integer type * @throws RuntimeException with a nested reflection-based * exception if the class does not hold field or is the wrong type, * or the field is inaccessible to the caller according to Java language * access control */ public static <U> AtomicIntegerFieldUpdater<U> newUpdater(Class<U> tclass, String fieldName) { return new AtomicIntegerFieldUpdaterImpl<U>(tclass, fieldName); }
/** * Creates and returns an updater for objects with the given field. * The Class argument is needed to check that reflective types and * generic types match. * * @param tclass the class of the objects holding the field * @param fieldName the name of the field to be updated * @return the updater * @throws IllegalArgumentException if the field is not a * volatile integer type * @throws RuntimeException with a nested reflection-based * exception if the class does not hold field or is the wrong type, * or the field is inaccessible to the caller according to Java language * access control */ public static <U> AtomicIntegerFieldUpdater<U> newUpdater(Class<U> tclass, String fieldName) { return new AtomicIntegerFieldUpdaterImpl<U>(tclass, fieldName); }
/** * Creates and returns an updater for objects with the given field. * The Class argument is needed to check that reflective types and * generic types match. * * @param tclass the class of the objects holding the field * @param fieldName the name of the field to be updated * @return the updater * @throws IllegalArgumentException if the field is not a * volatile integer type * @throws RuntimeException with a nested reflection-based * exception if the class does not hold field or is the wrong type, * or the field is inaccessible to the caller according to Java language * access control */ public static <U> AtomicIntegerFieldUpdater<U> newUpdater(Class<U> tclass, String fieldName) { return new AtomicIntegerFieldUpdaterImpl<U>(tclass, fieldName); }
/** * Creates and returns an updater for objects with the given field. * The Class argument is needed to check that reflective types and * generic types match. * * @param tclass the class of the objects holding the field * @param fieldName the name of the field to be updated * @return the updater * @throws IllegalArgumentException if the field is not a * volatile integer type * @throws RuntimeException with a nested reflection-based * exception if the class does not hold field or is the wrong type */ public static <U> AtomicIntegerFieldUpdater<U> newUpdater(Class<U> tclass, String fieldName) { return new AtomicIntegerFieldUpdaterImpl<U>(tclass, fieldName); }
/** * Creates and returns an updater for objects with the given field. * The Class argument is needed to check that reflective types and * generic types match. * * @param tclass the class of the objects holding the field * @param fieldName the name of the field to be updated * @return the updater * @throws IllegalArgumentException if the field is not a * volatile integer type * @throws RuntimeException with a nested reflection-based * exception if the class does not hold field or is the wrong type, * or the field is inaccessible to the caller according to Java language * access control */ public static <U> AtomicIntegerFieldUpdater<U> newUpdater(Class<U> tclass, String fieldName) { return new AtomicIntegerFieldUpdaterImpl<U>(tclass, fieldName); }
/** * Creates and returns an updater for objects with the given field. * The Class argument is needed to check that reflective types and * generic types match. * * @param tclass the class of the objects holding the field * @param fieldName the name of the field to be updated * @return the updater * @throws IllegalArgumentException if the field is not a * volatile integer type * @throws RuntimeException with a nested reflection-based * exception if the class does not hold field or is the wrong type, * or the field is inaccessible to the caller according to Java language * access control */ public static <U> AtomicIntegerFieldUpdater<U> newUpdater(Class<U> tclass, String fieldName) { return new AtomicIntegerFieldUpdaterImpl<U>(tclass, fieldName); }
/** * Creates and returns an updater for objects with the given field. * The Class argument is needed to check that reflective types and * generic types match. * * @param tclass the class of the objects holding the field * @param fieldName the name of the field to be updated * @return the updater * @throws IllegalArgumentException if the field is not a * volatile integer type * @throws RuntimeException with a nested reflection-based * exception if the class does not hold field or is the wrong type, * or the field is inaccessible to the caller according to Java language * access control */ public static <U> AtomicIntegerFieldUpdater<U> newUpdater(Class<U> tclass, String fieldName) { return new AtomicIntegerFieldUpdaterImpl<U>(tclass, fieldName); }
/** * Creates and returns an updater for objects with the given field. * The Class argument is needed to check that reflective types and * generic types match. * * @param tclass the class of the objects holding the field * @param fieldName the name of the field to be updated * @return the updater * @throws IllegalArgumentException if the field is not a * volatile integer type * @throws RuntimeException with a nested reflection-based * exception if the class does not hold field or is the wrong type */ public static <U> AtomicIntegerFieldUpdater<U> newUpdater(Class<U> tclass, String fieldName) { return new AtomicIntegerFieldUpdaterImpl<U>(tclass, fieldName); }
public boolean weakCompareAndSet(T obj, int expect, int update) { return compareAndSet(obj, expect, update); }
/** * Creates and returns an updater for objects with the given field. * The Class argument is needed to check that reflective types and * generic types match. * * @param tclass the class of the objects holding the field * @param fieldName the name of the field to be updated * @return the updater * @throws IllegalArgumentException if the field is not a * volatile integer type * @throws RuntimeException with a nested reflection-based * exception if the class does not hold field or is the wrong type */ public static <U> AtomicIntegerFieldUpdater<U> newUpdater(Class<U> tclass, String fieldName) { return new AtomicIntegerFieldUpdaterImpl<U>(tclass, fieldName); }
public void set(T obj, int newValue) { if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj); unsafe.putIntVolatile(obj, offset, newValue); }
public boolean compareAndSet(T obj, int expect, int update) { if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj); return unsafe.compareAndSwapInt(obj, offset, expect, update); }
public boolean weakCompareAndSet(T obj, int expect, int update) { return compareAndSet(obj, expect, update); }
public final int get(T obj) { if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj); return unsafe.getIntVolatile(obj, offset); }
public boolean compareAndSet(T obj, int expect, int update) { if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj); return unsafe.compareAndSwapInt(obj, offset, expect, update); }
public void lazySet(T obj, int newValue) { if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj); unsafe.putOrderedInt(obj, offset, newValue); }