AccountsUpdate: Rename update method to replace

The update methods performs a non-atomic update. This means the existing
account with the same ID is overwritten and any concurrent updates that
have been done to that account since it was read are lost. To make this
clear and to motivate callers to use atomicUpdate instead rename the
update method to replace.

Gerrit core has no callers of this method, but we want to keep it in
case it's needed by plugins.

Change-Id: I9de9303040c4b4215c8dfdee69e5e20225064e99
Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountsUpdate.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountsUpdate.java
index f5ece30..03950ed 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountsUpdate.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountsUpdate.java
@@ -217,28 +217,6 @@
   }
 
   /**
-   * Updates the account.
-   *
-   * <p>Changing the registration date of an account is not supported.
-   *
-   * @param db ReviewDb
-   * @param account the account
-   * @throws OrmException if updating the database fails
-   * @throws IOException if updating the user branch fails
-   * @throws ConfigInvalidException if any of the account fields has an invalid value
-   */
-  public void update(ReviewDb db, Account account)
-      throws OrmException, IOException, ConfigInvalidException {
-    // Update in ReviewDb
-    db.accounts().update(ImmutableSet.of(account));
-
-    // Update in NoteDb
-    AccountConfig accountConfig = read(account.getId());
-    accountConfig.setAccount(account);
-    commit(accountConfig);
-  }
-
-  /**
    * Gets the account and updates it atomically.
    *
    * <p>Changing the registration date of an account is not supported.
@@ -292,6 +270,36 @@
   }
 
   /**
+   * Replaces the account.
+   *
+   * <p>The existing account with the same account ID is overwritten by the given account. Choosing
+   * to overwrite an account means that any updates that were done to the account by a racing
+   * request after the account was read are lost. Updates are also lost if the account was read from
+   * a stale account index. This is why using {@link #atomicUpdate(ReviewDb,
+   * com.google.gerrit.reviewdb.client.Account.Id, Consumer)} to do an atomic update is always
+   * preferred.
+   *
+   * <p>Changing the registration date of an account is not supported.
+   *
+   * @param db ReviewDb
+   * @param account the new account
+   * @throws OrmException if updating the database fails
+   * @throws IOException if updating the user branch fails
+   * @throws ConfigInvalidException if any of the account fields has an invalid value
+   * @see #atomicUpdate(ReviewDb, com.google.gerrit.reviewdb.client.Account.Id, Consumer)
+   */
+  public void replace(ReviewDb db, Account account)
+      throws OrmException, IOException, ConfigInvalidException {
+    // Update in ReviewDb
+    db.accounts().update(ImmutableSet.of(account));
+
+    // Update in NoteDb
+    AccountConfig accountConfig = read(account.getId());
+    accountConfig.setAccount(account);
+    commit(accountConfig);
+  }
+
+  /**
    * Deletes the account.
    *
    * @param db ReviewDb