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


Java Util.createRandomAddress方法代码示例

本文整理汇总了Java中org.jgroups.util.Util.createRandomAddress方法的典型用法代码示例。如果您正苦于以下问题:Java Util.createRandomAddress方法的具体用法?Java Util.createRandomAddress怎么用?Java Util.createRandomAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jgroups.util.Util的用法示例。


在下文中一共展示了Util.createRandomAddress方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testResponsesComplete3

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void testResponsesComplete3() {
    Address one=new SiteUUID((UUID)Util.createRandomAddress("lon1"), "lon1", "LON");
    Address two=new SiteUUID((UUID)Util.createRandomAddress("sfo1"), "sfo1", "SFO");
    Address three=new SiteUUID((UUID)Util.createRandomAddress("nyc1"), "nyc1", "NYC");

    GroupRequest<Integer> req=new GroupRequest<>(null, null, Arrays.asList(one, two, three), RequestOptions.SYNC());
    req.suspect(one);
    req.receiveResponse(1, one, false);
    req.siteUnreachable("LON");
    checkComplete(req, false);

    req.siteUnreachable("SFO");
    req.receiveResponse(2, two, false);
    req.suspect(two);
    checkComplete(req, false);

    req.siteUnreachable("NYC");
    checkComplete(req, true);
    req.suspect(three);
    checkComplete(req, true);
    req.receiveResponse(3, three, false);
    checkComplete(req, true);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:24,代码来源:GroupRequestTest.java

示例2: testDontLoopback

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void testDontLoopback() {
    final Address DEST=Util.createRandomAddress("A");
    Message msg=new Message(null).setTransientFlag(Message.TransientFlag.DONT_LOOPBACK);

    msg.dest(null); // OK
    msg.setDest(null);

    msg.dest(DEST);

    msg.clearTransientFlag(Message.TransientFlag.DONT_LOOPBACK);
    msg.dest(DEST); // OK
    msg.setTransientFlag(Message.TransientFlag.DONT_LOOPBACK);
    msg.setTransientFlagIfAbsent(Message.TransientFlag.DONT_LOOPBACK);

    short flags=(short)(Message.TransientFlag.DONT_LOOPBACK.value() + Message.TransientFlag.OOB_DELIVERED.value());
    msg.setTransientFlag(flags);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:18,代码来源:MessageTest.java

示例3: setUp

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeMethod
void setUp() throws Exception {
    rl=new RspList();
    a1=Util.createRandomAddress();
    a2=Util.createRandomAddress();
    a3=Util.createRandomAddress();
    a4=Util.createRandomAddress();
    a5=Util.createRandomAddress();
    rsp1=new Rsp(a1);
    rsp2=new Rsp(a2);
    rsp2.setSuspected();
    rsp3=new Rsp(a3, "hello world");
    rsp4=new Rsp(a4, Boolean.TRUE);
    rsp5=new Rsp(a5);
    rsp5.setSuspected();
    rl.put(a1, rsp1);
    rl.put(a2, rsp2);
    rl.put(a3, rsp3);
    rl.put(a4, rsp4);
    rl.put(a5, rsp5);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:22,代码来源:RspListTest.java

示例4: testNonConflictingMerge

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void testNonConflictingMerge() {
    Address ip1=Util.createRandomAddress("x"), ip2=Util.createRandomAddress("y");
    View tmp_view=View.create(a1,1,a1,a2,a3,ip1,ip2);
    MutableDigest cons_d=new MutableDigest(tmp_view.getMembersRaw());

    cons_d.set(ip1,10,10);
    cons_d.set(ip2,20,20);
    cons_d.merge(d);

    Assert.assertEquals(cons_d.capacity(), 5);

    Assert.assertEquals(cons_d.get(ip1)[0], 10);
    Assert.assertEquals(cons_d.get(ip2)[0], 20);
    Assert.assertEquals(cons_d.get(a1)[0], 500);
    Assert.assertEquals(cons_d.get(a2)[0], 26);
    Assert.assertEquals(cons_d.get(a3)[0], 25);

    Assert.assertEquals(cons_d.get(ip1)[1], 10);
    Assert.assertEquals(cons_d.get(ip2)[1], 20);
    Assert.assertEquals(cons_d.get(a1)[1], 501);
    Assert.assertEquals(cons_d.get(a2)[1], 26);
    Assert.assertEquals(cons_d.get(a3)[1], 33);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:24,代码来源:DigestTest.java

示例5: testReset

import org.jgroups.util.Util; //导入方法依赖的package包/类
@Test(expectedExceptions=TimeoutException.class)
public void testReset() throws TimeoutException {
    final AckCollector ac=new AckCollector(list);
    final Address six=Util.createRandomAddress("six"), seven=Util.createRandomAddress("seven"),
      eight=Util.createRandomAddress("eight");
    final List<Address> new_list=Arrays.asList(six, seven, eight);
    new Thread() {
        public void run() {
            Util.sleep(500);
            System.out.println("resetting AckCollector");
            ac.reset(new_list);
            System.out.println("reset AckCollector: " + ac);
        }
    }.start();
    System.out.println("initial AckCollector: " + ac);
    ac.waitForAllAcks(1000);
    System.out.println("new AckCollector: " + ac);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:19,代码来源:AckCollectorTest.java

示例6: setUp

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeMethod
void setUp() {
    a1=Util.createRandomAddress();
    a2=Util.createRandomAddress();
    a3=a2;
    a4=Util.createRandomAddress();
    a5=Util.createRandomAddress();
    m1=new Membership();
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:10,代码来源:MembershipTest.java

示例7: setUp

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeClass
void setUp() throws UnknownHostException {
    v1=new ViewId(Util.createRandomAddress("A"), 22);
    v2=new ViewId(Util.createRandomAddress("B"), 21);
    v3=v1.copy();
    v4=new ViewId(Util.createRandomAddress("C"), 22);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:8,代码来源:ViewIdTest.java

示例8: setUp

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeClass
void setUp() throws Exception {
    a=Util.createRandomAddress("A");
    b=Util.createRandomAddress("B");
    c=Util.createRandomAddress("C");
    d=Util.createRandomAddress("D");
    e=Util.createRandomAddress("E");
    f=Util.createRandomAddress("F");
    g=Util.createRandomAddress("G");
    h=Util.createRandomAddress("H");
    i=Util.createRandomAddress("I");
    members=Arrays.asList(a, b, c, d, e, f, g, h);
    view=View.create(a, 34, a, b, c, d, e, f, g, h);

}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:16,代码来源:ViewTest.java

示例9: testMarshalling2

import org.jgroups.util.Util; //导入方法依赖的package包/类
public static void testMarshalling2() throws Exception {
    Address addr=Util.createRandomAddress("A");
    MethodCall call=new MethodCall("foo",
                                   new Object[]{"hello", 23, addr},
                                   new Class[]{String.class, int.class, Address.class});
    MethodCall m=marshalAndUnmarshal(call);
    System.out.println("m = " + m);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:9,代码来源:MethodCallTest.java

示例10: testReset2

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void testReset2() throws TimeoutException {
    final AckCollector ac=new AckCollector(list);
    final Address six=Util.createRandomAddress("six"), seven=Util.createRandomAddress("seven"),
      eight=Util.createRandomAddress("eight");
    final List<Address> new_list=Arrays.asList(six, seven, eight);

    new Thread() {
        public void run() {
            Util.sleep(500);
            System.out.println("resetting AckCollector");
            ac.reset(new_list);
            System.out.println("reset AckCollector: " + ac);
            Util.sleep(100);
            ac.ack(six);
            System.out.println("AckCollector: " + ac);
            Util.sleep(100);
            ac.ack(seven);
            System.out.println("AckCollector: " + ac);
            Util.sleep(100);
            ac.ack(eight);
            System.out.println("AckCollector: " + ac);
        }
    }.start();
    System.out.println("initial AckCollector: " + ac);
    ac.waitForAllAcks(30000);
    System.out.println("new AckCollector: " + ac);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:28,代码来源:AckCollectorTest.java

示例11: init

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeClass
void init() throws UnknownHostException {
    a=Util.createRandomAddress("A");
    b=Util.createRandomAddress("B");
    c=Util.createRandomAddress("C");
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:7,代码来源:GroupRequestTest.java

示例12: beforeClass

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeClass void beforeClass() throws Exception {
    a1=Util.createRandomAddress("a1");
    a2=Util.createRandomAddress("a2");
    a3=Util.createRandomAddress("a3");
    members=new Address[]{a1,a2,a3};
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:7,代码来源:DigestTest.java

示例13: testOneList

import org.jgroups.util.Util; //导入方法依赖的package包/类
public static void testOneList() throws TimeoutException {
    Address addr=Util.createRandomAddress();
    AckCollector coll=new AckCollector(addr);
    coll.ack(addr);
    coll.waitForAllAcks(1000);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:7,代码来源:AckCollectorTest.java


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