当前位置: 首页>>代码示例>>Java>>正文


Java HostProvider.next方法代码示例

本文整理汇总了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));
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:9,代码来源:StaticHostProviderTest.java

示例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);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:14,代码来源:StaticHostProviderTest.java

示例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);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:14,代码来源:StaticHostProviderTest.java

示例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);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:9,代码来源:StaticHostProviderTest.java

示例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());
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:16,代码来源:StaticHostProviderTest.java

示例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));
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:9,代码来源:StaticHostProviderTest.java

示例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);
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:14,代码来源:StaticHostProviderTest.java

示例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);
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:14,代码来源:StaticHostProviderTest.java

示例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);
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:9,代码来源:StaticHostProviderTest.java

示例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());
    }
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:16,代码来源:StaticHostProviderTest.java

示例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);
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:14,代码来源:StaticHostProviderTest.java

示例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);
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:14,代码来源:StaticHostProviderTest.java

示例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);
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:9,代码来源:StaticHostProviderTest.java

示例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));
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:9,代码来源:StaticHostProviderTest.java

示例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);
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:14,代码来源:StaticHostProviderTest.java


注:本文中的org.apache.zookeeper.client.HostProvider.next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。