private static Optional<String> stackUnit(Stack stack, String serviceName, String configType, String propertyName) {
      try {
        return Optional.ofNullable(
          stack.getConfigurationPropertiesWithMetadata(serviceName, configType)
            .get(propertyName)
            .getPropertyValueAttributes()
            .getUnit());
      } catch (NullPointerException e) {
        return Optional.empty();
      }
    }
@return property value with removed unit
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UnitUpdater.java