code: public static long getAndAddRequest(AtomicLong requested, long n) {
          // add n to field but check for overflow
          while (true) {
              long current = requested.get();
              long next = current + n;
              // check for overflow
              if (next < 0) {
                  next = Long.MAX_VALUE;
              }
              if (requested.compareAndSet(current, next)) {
                  return current;
              }
          }
      }
docs: Adds {@code n} to {@code requested} and returns the value prior to
  addition once the addition is successful (uses CAS semantics). If
  overflows then sets {@code requested} field to {@code Long.MAX_VALUE}.
  
  @param requested
  atomic field updater for a request count
  @param object
  contains the field updated by the updater
  @param n
  the number of requests to add to the requested count
  @return requested value just prior to successful addition