本文整理了Java中org.apache.kafka.common.utils.Utils.min()
方法的一些代码示例,展示了Utils.min()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.min()
方法的具体详情如下:
包路径:org.apache.kafka.common.utils.Utils
类名称:Utils
方法名:min
[英]Get the minimum of some long values.
[中]获取一些长值的最小值。
代码示例来源:origin: apache/kafka
private String apiVersionToText(ApiVersion apiVersion) {
StringBuilder bld = new StringBuilder();
ApiKeys apiKey = null;
if (ApiKeys.hasId(apiVersion.apiKey)) {
apiKey = ApiKeys.forId(apiVersion.apiKey);
bld.append(apiKey.name).append("(").append(apiKey.id).append("): ");
} else {
bld.append("UNKNOWN(").append(apiVersion.apiKey).append("): ");
}
if (apiVersion.minVersion == apiVersion.maxVersion) {
bld.append(apiVersion.minVersion);
} else {
bld.append(apiVersion.minVersion).append(" to ").append(apiVersion.maxVersion);
}
if (apiKey != null) {
ApiVersion supportedVersion = supportedVersions.get(apiKey);
if (apiKey.latestVersion() < supportedVersion.minVersion) {
bld.append(" [unusable: node too new]");
} else if (supportedVersion.maxVersion < apiKey.oldestVersion()) {
bld.append(" [unusable: node too old]");
} else {
short latestUsableVersion = Utils.min(apiKey.latestVersion(), supportedVersion.maxVersion);
bld.append(" [usable: ").append(latestUsableVersion).append("]");
}
}
return bld.toString();
}
代码示例来源:origin: apache/kafka
@Test
public void testMin() {
assertEquals(1, Utils.min(1));
assertEquals(1, Utils.min(1, 2, 3));
assertEquals(1, Utils.min(2, 1, 3));
assertEquals(1, Utils.min(2, 3, 1));
}
代码示例来源:origin: apache/kafka
this.selector.poll(Utils.min(timeout, metadataTimeout, defaultRequestTimeoutMs));
} catch (IOException e) {
log.error("Unexpected error during I/O", e);
内容来源于网络,如有侵权,请联系作者删除!