本文整理了Java中azkaban.utils.Utils.isValidPort()
方法的一些代码示例,展示了Utils.isValidPort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.isValidPort()
方法的具体详情如下:
包路径:azkaban.utils.Utils
类名称:Utils
方法名:isValidPort
[英]Tests whether a port is valid or not
[中]测试端口是否有效
代码示例来源:origin: azkaban/azkaban
/**
* <pre>
* Construct an Executor Object
* Note: port should be a within unsigned 2 byte
* integer range
* </pre>
*/
public Executor(final int id, final String host, final int port, final boolean isActive) {
if (!Utils.isValidPort(port)) {
throw new IllegalArgumentException(String.format(
"Invalid port number %d for host %s, executor_id %d", port, host, id));
}
this.id = id;
this.host = host;
this.port = port;
this.isActive = isActive;
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testValidPort() {
Assert.assertTrue(Utils.isValidPort(1023));
Assert.assertTrue(Utils.isValidPort(10000));
Assert.assertTrue(Utils.isValidPort(3030));
Assert.assertTrue(Utils.isValidPort(1045));
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testOverflowPort() {
Assert.assertFalse(Utils.isValidPort(70000));
Assert.assertFalse(Utils.isValidPort(65536));
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testNegativePort() {
Assert.assertFalse(Utils.isValidPort(-1));
Assert.assertFalse(Utils.isValidPort(-10));
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testZeroPort() {
Assert.assertFalse(Utils.isValidPort(0));
}
代码示例来源:origin: com.linkedin.azkaban/azkaban-common
/**
* <pre>
* Construct an Executor Object
* Note: port should be a within unsigned 2 byte
* integer range
* </pre>
*/
public Executor(final int id, final String host, final int port, final boolean isActive) {
if (!Utils.isValidPort(port)) {
throw new IllegalArgumentException(String.format(
"Invalid port number %d for host %s, executor_id %d", port, host, id));
}
this.id = id;
this.host = host;
this.port = port;
this.isActive = isActive;
}
内容来源于网络,如有侵权,请联系作者删除!