public boolean updateStatsAndReturnWhetherAllowed(){
  long now=SystemClock.elapsedRealtime();
  long deltaMs=now - mLastRequestMs;
  if (deltaMs < mDelayMs)   return false;
  mLastRequestMs=now;
  if (deltaMs < 2 * mDelayMs) {
    mDelayMs=Math.min(MAX_DELAY,mDelayMs * 2);
  }
 else {
    mDelayMs=MIN_DELAY;
  }
  return true;
}

public boolean updateStatsAndReturnWhetherAllowed ( ) { long now = SystemClock . elapsedRealtime ( ) ; long deltaMs = now - mLastRequestMs ; if ( deltaMs < mDelayMs ) return false ; mLastRequestMs = now ; if ( deltaMs < 2 * mDelayMs ) { mDelayMs = Math . min ( MAX_DELAY , mDelayMs * 2 ) ; } else { mDelayMs = MIN_DELAY ; } return true ; }
updates the prediction stats and returns whether prediction is allowed . the policy is : 1 . if the client does not wait more than mdelayms , decline the request . 2 . if the client waits for more than mdelayms but less than 2 * mdelayms , accept the request and double mdelayms . 3 . if the client waits for more than 2 * mdelayms , accept the request and reset mdelayms . and : 100ms < = mdelayms < = 10s . this way , if an application sends a burst of requests , it is quickly seriously throttled . if it stops being this way , back to normal .
