本文整理汇总了Java中org.apache.zookeeper.client.HostProvider.next方法的典型用法代码示例。如果您正苦于以下问题:Java HostProvider.next方法的具体用法?Java HostProvider.next怎么用?Java HostProvider.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.zookeeper.client.HostProvider
的用法示例。
在下文中一共展示了HostProvider.next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNextGoesRound
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testNextGoesRound() throws UnknownHostException {
HostProvider hostProvider = getHostProvider((byte) 2);
InetSocketAddress first = hostProvider.next(0);
assertTrue(first instanceof InetSocketAddress);
hostProvider.next(0);
assertEquals(first, hostProvider.next(0));
}
示例2: testNextGoesRoundAndSleeps
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testNextGoesRoundAndSleeps() throws UnknownHostException {
byte size = 2;
HostProvider hostProvider = getHostProvider(size);
while (size > 0) {
hostProvider.next(0);
--size;
}
long start = System.currentTimeMillis();
hostProvider.next(1000);
long stop = System.currentTimeMillis();
assertTrue(900 <= stop - start);
}
示例3: testNextDoesNotSleepForZero
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testNextDoesNotSleepForZero() throws UnknownHostException {
byte size = 2;
HostProvider hostProvider = getHostProvider(size);
while (size > 0) {
hostProvider.next(0);
--size;
}
long start = System.currentTimeMillis();
hostProvider.next(0);
long stop = System.currentTimeMillis();
assertTrue(5 > stop - start);
}
示例4: testOnConnectDoesNotReset
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testOnConnectDoesNotReset() throws UnknownHostException {
HostProvider hostProvider = getHostProvider((byte) 2);
InetSocketAddress first = hostProvider.next(0);
hostProvider.onConnected();
InetSocketAddress second = hostProvider.next(0);
assertNotSame(first, second);
}
示例5: testLiteralIPNoReverseNS
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testLiteralIPNoReverseNS() throws Exception {
byte size = 30;
HostProvider hostProvider = getHostProviderUnresolved(size);
for (int i = 0; i < size; i++) {
InetSocketAddress next = hostProvider.next(0);
assertTrue(next instanceof InetSocketAddress);
assertTrue(!next.isUnresolved());
assertTrue("Did not match "+ next.toString(), !next.toString().startsWith("/"));
// Do NOT trigger the reverse name service lookup.
String hostname = next.getHostName();
// In this case, the hostname equals literal IP address.
hostname.equals(next.getAddress().getHostAddress());
}
}
示例6: testNextGoesRound
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testNextGoesRound() {
HostProvider hostProvider = getHostProvider((byte) 2);
InetSocketAddress first = hostProvider.next(0);
assertTrue(first != null);
hostProvider.next(0);
assertEquals(first, hostProvider.next(0));
}
示例7: testNextGoesRoundAndSleeps
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testNextGoesRoundAndSleeps() {
byte size = 2;
HostProvider hostProvider = getHostProvider(size);
while (size > 0) {
hostProvider.next(0);
--size;
}
long start = Time.currentElapsedTime();
hostProvider.next(1000);
long stop = Time.currentElapsedTime();
assertTrue(900 <= stop - start);
}
示例8: testNextDoesNotSleepForZero
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testNextDoesNotSleepForZero() {
byte size = 2;
HostProvider hostProvider = getHostProvider(size);
while (size > 0) {
hostProvider.next(0);
--size;
}
long start = Time.currentElapsedTime();
hostProvider.next(0);
long stop = Time.currentElapsedTime();
assertTrue(5 > stop - start);
}
示例9: testOnConnectDoesNotReset
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testOnConnectDoesNotReset() {
HostProvider hostProvider = getHostProvider((byte) 2);
InetSocketAddress first = hostProvider.next(0);
hostProvider.onConnected();
InetSocketAddress second = hostProvider.next(0);
assertNotSame(first, second);
}
示例10: testLiteralIPNoReverseNS
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testLiteralIPNoReverseNS() throws Exception {
byte size = 30;
HostProvider hostProvider = getHostProviderUnresolved(size);
for (int i = 0; i < size; i++) {
InetSocketAddress next = hostProvider.next(0);
assertTrue(next instanceof InetSocketAddress);
assertTrue(!next.isUnresolved());
assertTrue(!next.toString().startsWith("/"));
// Do NOT trigger the reverse name service lookup.
String hostname = next.getHostString();
// In this case, the hostname equals literal IP address.
hostname.equals(next.getAddress().getHostAddress());
}
}
示例11: testNextGoesRoundAndSleeps
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testNextGoesRoundAndSleeps() throws UnknownHostException {
int size = 2;
HostProvider hostProvider = getHostProvider(size);
while (size > 0) {
hostProvider.next(0);
--size;
}
long start = System.currentTimeMillis();
hostProvider.next(1000);
long stop = System.currentTimeMillis();
assertTrue(900 <= stop - start);
}
示例12: testNextDoesNotSleepForZero
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testNextDoesNotSleepForZero() throws UnknownHostException {
int size = 2;
HostProvider hostProvider = getHostProvider(size);
while (size > 0) {
hostProvider.next(0);
--size;
}
long start = System.currentTimeMillis();
hostProvider.next(0);
long stop = System.currentTimeMillis();
assertTrue(5 > stop - start);
}
示例13: testOnConnectDoesNotReset
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testOnConnectDoesNotReset() throws UnknownHostException {
HostProvider hostProvider = getHostProvider(2);
InetSocketAddress first = hostProvider.next(0);
hostProvider.onConnected();
InetSocketAddress second = hostProvider.next(0);
assertNotSame(first, second);
}
示例14: testNextGoesRound
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testNextGoesRound() throws UnknownHostException {
HostProvider hostProvider = getHostProvider(2);
InetSocketAddress first = hostProvider.next(0);
assertTrue(first instanceof InetSocketAddress);
hostProvider.next(0);
assertEquals(first, hostProvider.next(0));
}
示例15: testNextDoesNotSleepForZero
import org.apache.zookeeper.client.HostProvider; //导入方法依赖的package包/类
@Test
public void testNextDoesNotSleepForZero() throws UnknownHostException {
int size = 2;
HostProvider hostProvider = getHostProvider(size);
while (size > 0) {
hostProvider.next(0);
--size;
}
long start = System.currentTimeMillis();
hostProvider.next(0);
long stop = System.currentTimeMillis();
assertTrue(10000 > stop - start);
}