public int getThresholdValue(Object value, int defaultValue) {
    if (null == value) {
      return defaultValue;
    }

    if (value instanceof Number) {
      return ((Number) value).intValue();
    }

    if (!(value instanceof String)) {
      value = value.toString();
    }

    if (!NumberUtils.isNumber((String) value)) {
      return defaultValue;
    }

    Number number = NumberUtils.createNumber((String) value);
    return number.intValue();
  }
Converts the given value to an integer safely.

@param value
@param defaultValue
@return
ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertHelper.java