Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
          +++ new/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
↓ open down ↓ 47 lines elided ↑ open up ↑
  48   48   * method in this class are weaker than in other atomic classes.
  49   49   * Because this class cannot ensure that all uses of the field
  50   50   * are appropriate for purposes of atomic access, it can
  51   51   * guarantee atomicity only with respect to other invocations of
  52   52   * {@code compareAndSet} and {@code set} on the same updater.
  53   53   *
  54   54   * @since 1.5
  55   55   * @author Doug Lea
  56   56   * @param <T> The type of the object holding the updatable field
  57   57   */
  58      -public abstract class  AtomicIntegerFieldUpdater<T>  {
       58 +public abstract class  AtomicIntegerFieldUpdater<T> {
  59   59      /**
  60   60       * Creates and returns an updater for objects with the given field.
  61   61       * The Class argument is needed to check that reflective types and
  62   62       * generic types match.
  63   63       *
  64   64       * @param tclass the class of the objects holding the field
  65   65       * @param fieldName the name of the field to be updated
  66   66       * @return the updater
  67   67       * @throws IllegalArgumentException if the field is not a
  68   68       * volatile integer type
↓ open down ↓ 203 lines elided ↑ open up ↑
 272  272              Field field = null;
 273  273              Class caller = null;
 274  274              int modifiers = 0;
 275  275              try {
 276  276                  field = tclass.getDeclaredField(fieldName);
 277  277                  caller = sun.reflect.Reflection.getCallerClass(3);
 278  278                  modifiers = field.getModifiers();
 279  279                  sun.reflect.misc.ReflectUtil.ensureMemberAccess(
 280  280                      caller, tclass, null, modifiers);
 281  281                  sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass);
 282      -            } catch(Exception ex) {
      282 +            } catch (Exception ex) {
 283  283                  throw new RuntimeException(ex);
 284  284              }
 285  285  
 286  286              Class fieldt = field.getType();
 287  287              if (fieldt != int.class)
 288  288                  throw new IllegalArgumentException("Must be integer type");
 289  289  
 290  290              if (!Modifier.isVolatile(modifiers))
 291  291                  throw new IllegalArgumentException("Must be volatile type");
 292  292  
↓ open down ↓ 54 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX