public Integer incrementConsecutiveAuthenticationFailures(UserEntity userEntity) {
    if (userEntity != null) {
      Command command = new Command() {
        @Override
        public void perform(UserEntity userEntity) {
          userEntity.incrementConsecutiveFailures();
        }
      };

      userEntity = safelyUpdateUserEntity(userEntity, command, MAX_RETRIES);
    }

    return (userEntity == null) ? null : userEntity.getConsecutiveFailures();
  }
Increments the named user's consecutive authentication failure count by <code>1</code>.
<p>
This operation is safe when concurrent authentication attempts by the same username are made
due to {@link UserEntity#version} and optimistic locking.

@param userEntity the user
@return the updated number of consecutive authentication failures; or null if the user does not exist
ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java