aidanow-uni commented on PR #1469: URL: https://github.com/apache/commons-lang/pull/1469#issuecomment-3446644524
A concrete use case for StringUtils.firstNonBlankSupplier() exists in the assignOneCluster method of the SinkServiceImpl class in Apache Inlong. [assignOneCluster](https://github.com/apache/inlong/blob/fdfc7829fcd4c8e082b9d5852c75fb287633daed/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/AbstractStandaloneSinkResourceOperator.java#L102) Both assignFromExist() and assignFromRelated() are evaluated eagerly, even though firstNonBlank will only use the first non-blank result. These methods can be non-trivial (e.g., database lookups or network calls). Using the new supplier-based version would avoid that overhead: return StringUtils.firstNonBlankSupplier( () -> assignFromExist(sinkInfo.getDataNodeName(), group.getInlongClusterTag()), () -> assignFromRelated(sinkInfo.getSinkType(), group) ); -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
