@Test public void testDefaultPort() { Assert.assertEquals("10.20.153.10:2181", ZookeeperRegistry.appendDefaultPort("10.20.153.10:0")); Assert.assertEquals("10.20.153.10:2181", ZookeeperRegistry.appendDefaultPort("10.20.153.10")); }
static String appendDefaultPort(String address) { if (address != null && address.length() > 0) { int i = address.indexOf(':'); if (i < 0) { return address + ":" + DEFAULT_ZOOKEEPER_PORT; } else if (Integer.parseInt(address.substring(i + 1)) == 0) { return address.substring(0, i + 1) + DEFAULT_ZOOKEEPER_PORT; } } return address; }
ZookeeperRegistry extends FailbackRegistry { static String appendDefaultPort(String address) { if (address != null && address.length() > 0) { int i = address.indexOf(':'); if (i < 0) { return address + ":" + DEFAULT_ZOOKEEPER_PORT; } else if (Integer.parseInt(address.substring(i + 1)) == 0) { return address.substring(0, i + 1) + DEFAULT_ZOOKEEPER_PORT; } } return address; } }
ZookeeperRegistry extends FailbackRegistry { static String appendDefaultPort(String address) { if (address != null && address.length() > 0) { int i = address.indexOf(':'); if (i < 0) { return address + ":" + DEFAULT_ZOOKEEPER_PORT; } else if (Integer.parseInt(address.substring(i + 1)) == 0) { return address.substring(0, i + 1) + DEFAULT_ZOOKEEPER_PORT; } } return address; } ZookeeperRegistry(URL url, ZookeeperTransporter zookeeperTransporter); }
ZookeeperRegistry extends FailbackRegistry { static String appendDefaultPort(String address) { if (address != null && address.length() > 0) { int i = address.indexOf(':'); if (i < 0) { return address + ":" + DEFAULT_ZOOKEEPER_PORT; } else if (Integer.parseInt(address.substring(i + 1)) == 0) { return address.substring(0, i + 1) + DEFAULT_ZOOKEEPER_PORT; } } return address; } ZookeeperRegistry(URL url, ZookeeperTransporter zookeeperTransporter); @Override boolean isAvailable(); @Override void destroy(); @Override List<URL> lookup(URL url); }
ZookeeperRegistry extends FailbackRegistry { static String appendDefaultPort(String address) { if (address != null && address.length() > 0) { int i = address.indexOf(':'); if (i < 0) { return address + ":" + DEFAULT_ZOOKEEPER_PORT; } else if (Integer.parseInt(address.substring(i + 1)) == 0) { return address.substring(0, i + 1) + DEFAULT_ZOOKEEPER_PORT; } } return address; } ZookeeperRegistry(URL url, ZookeeperTransporter zookeeperTransporter); @Override boolean isAvailable(); @Override void destroy(); @Override List<URL> lookup(URL url);  }