private boolean checkID(long id) {
    // Ensure that the given ID is a monotonically increasing ID.
    // If the ID is less than the last received ID then reset the
    // last received ID since the connection must have been reset.
    if (lastReceived == 0 || id == lastReceived + 1 || id < lastReceived) {
      lastReceived = id;
      // If the ID reaches the end of the current batch then tell the data
      // source that it's okay to remove all previous messages.
      if (lastReceived % BATCH_SIZE == 0) {
        ack();
      }
      return true;
    } else {
      fail();
    }
    return false;
  }
private boolean checkID ( long id ) { if ( lastReceived == 0 || id == lastReceived + 1 || id < lastReceived ) { lastReceived = id ; if ( lastReceived % BATCH_SIZE == 0 ) { ack ( ) ; } return true ; } else { fail ( ) ; } return false ; }
Checks that the given ID is valid.