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


Java Util.waitUntilAllChannelsHaveSameSize方法代码示例

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


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

示例1: setUp

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeMethod
void setUp() throws Exception {
    channels       = new JChannel[2];
    dispatchers    = new RpcDispatcher[2];
    muxDispatchers = new RpcDispatcher[2][2];

    channels[0] = createChannel(true, 2, "A");
    channels[1] = createChannel(channels[0], "B");
    
    for (int i = 0; i < dispatchers.length; i++) {

        dispatchers[i] = new RpcDispatcher(channels[i], new Server("dispatcher[" + i + "]"));

        channels[i].setUpHandler(new MuxUpHandler(dispatchers[i].getProtocolAdapter()));

        for (int j = 0; j < muxDispatchers[i].length; j++) {
            muxDispatchers[i][j] = new MuxRpcDispatcher((short) j, channels[i], null, null, new Server("muxDispatcher[" + i + "][" + j + "]"));
        }
 
        channels[i].connect("MuxRpcDispatcherTest");

        Util.sleep(1000);
    }

    Util.waitUntilAllChannelsHaveSameSize(10000, 1000, channels);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:27,代码来源:MuxRpcDispatcherTest.java

示例2: setUp

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeMethod
protected void setUp() throws Exception {
    a=createChannel("A");
    disp1=new RpcDispatcher(a, new ServerObject(1));
    a.connect(GROUP);

    b=createChannel("B");
    disp2=new RpcDispatcher(b, new ServerObject(2));
    b.connect(GROUP);
    Util.waitUntilAllChannelsHaveSameSize(10000, 1000,a,b);

    c=createChannel("C");
    disp3=new RpcDispatcher(c, new ServerObject(3));
    c.connect(GROUP);

    Util.waitUntilAllChannelsHaveSameSize(10000, 1000,a,b,c);
    System.out.println("A=" + a.getView() + "\nB=" + b.getView() + "\nC=" + c.getView());
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:19,代码来源:RpcDispatcherTest.java

示例3: setUp

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeMethod
void setUp() throws Exception {
    a=new JChannel(props).name("A");
    a.connect(GROUP);
    r1=new MyReceiver("A");
    a.setReceiver(r1);

    b=new JChannel(props).name("B");
    b.connect(GROUP);
    r2=new MyReceiver("B");
    b.setReceiver(r2);

    c=new JChannel(props).name("C");
    c.connect(GROUP);
    r3=new MyReceiver("C");
    c.setReceiver(r3);

    Util.waitUntilAllChannelsHaveSameSize(10000, 1000,a,b,c);

    for(int i=0; i < senders.length; i++)
        senders[i]=new Sender(NUM_MSGS, num,a,b,c);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:23,代码来源:SequencerOrderTest.java

示例4: init

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeClass
protected void init() throws Exception {
    c1=createChannel("A");
    s1=new LockService(c1);
    c1.connect("LockServiceTest");

    c2=createChannel("B");
    s2=new LockService(c2);
    c2.connect("LockServiceTest");

    c3=createChannel("C");
    s3=new LockService(c3);
    c3.connect("LockServiceTest");

    Util.waitUntilAllChannelsHaveSameSize(10000, 1000, c1,c2,c3);
    lock=s1.getLock(LOCK);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:18,代码来源:LockServiceTest.java

示例5: start

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeMethod
protected void start() throws Exception {
    a=createChannel(true, 4).name("A");
    ra=new MyReceiver("A", a);
    a.setReceiver(ra);

    b=createChannel(a).name("B");
    rb=new MyReceiver("B", b);
    b.setReceiver(rb);

    c=createChannel(a).name("C");
    rc=new MyReceiver("C", c);
    c.setReceiver(rc);
    modifyConfigs(a,b,c);

    a.connect("OverlappingMergeTest");
    b.connect("OverlappingMergeTest");
    c.connect("OverlappingMergeTest");

    Util.waitUntilAllChannelsHaveSameSize(30000, 1000, a,b,c);
    multicast_transport=isMulticastTransport(a);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:23,代码来源:OverlappingMergeTest.java

示例6: testSingleChannel

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void testSingleChannel() throws Exception {
    Semaphore s = new Semaphore(1);
    FlushTestReceiver receivers[] ={ new FlushTestReceiver("c1", s, 0, FlushTestReceiver.CONNECT_ONLY) };
    receivers[0].start();
    s.release(1);

    // Make sure everyone is in sync
    Channel[] tmp = new Channel[receivers.length];
    for (int i = 0; i < receivers.length; i++)
        tmp[i] = receivers[i].getChannel();
    Util.waitUntilAllChannelsHaveSameSize(10000, 1000, tmp);

    // Reacquire the semaphore tickets; when we have them all we know the threads are done
    s.tryAcquire(1, 10, TimeUnit.SECONDS);
    receivers[0].cleanup();
    Util.sleep(1000);

    checkEventStateTransferSequence(receivers[0]);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:20,代码来源:FlushTest.java

示例7: testSequentialFlushInvocation

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void testSequentialFlushInvocation() throws Exception {
    Channel a=null, b=null, c=null;
    try {
        a = createChannel("A");
        a.connect("testSequentialFlushInvocation");

        b = createChannel("B");
        b.connect("testSequentialFlushInvocation");

        c = createChannel("C");
        c.connect("testSequentialFlushInvocation");

        Util.waitUntilAllChannelsHaveSameSize(10000, 1000, a,b,c);
        
        for (int i = 0; i < 100; i++) {
            System.out.print("flush #" + i + ": ");
            a.startFlush(false);
            a.stopFlush();
            System.out.println("OK");
        }
    } finally {
        Util.close(a, b, c);
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:25,代码来源:FlushTest.java

示例8: testMultipleConnectsAndDisconnects2

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void testMultipleConnectsAndDisconnects2() throws Exception {
    int NUM=10;
    a=createChannel(true, NUM, "A");
    a.connect("CloseTest");
    b=createChannel(a, "B");
    b.connect("CloseTest");
    Util.waitUntilAllChannelsHaveSameSize(10000, 500, a,b);

    for(int i=1; i <= NUM; i++) {
        System.out.print("#" + i + " disconnecting: ");
        b.disconnect();
        System.out.println("OK");
        Util.waitUntilAllChannelsHaveSameSize(10000, 500, a);
        b.connect("CloseTest");
        Util.waitUntilAllChannelsHaveSameSize(10000, 500, a,b);
    }
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:18,代码来源:CloseTest.java

示例9: setUp

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeMethod
protected void setUp() throws Exception {
    for(int i=0; i < NUM_PEERS; i++) {
        channels[i]=createChannel().name(Character.toString((char)(i + 'A')));
        channels[i].connect("NakackTest");
    }

    org.jgroups.Receiver[] receivers=new org.jgroups.Receiver[NUM_PEERS];

    // set up the sender and the receiver callbacks, according to whether the peer is a sender or a receiver
    for(int i=0; i < NUM_PEERS; i++) {
        receivers[i]=new Receiver(channels[i]);
        channels[i].setReceiver(receivers[i]);
    }
    Util.waitUntilAllChannelsHaveSameSize(10000, 1000, channels);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:17,代码来源:NakackTest.java

示例10: testSameCreatorDifferentIDs

import org.jgroups.util.Util; //导入方法依赖的package包/类
/**
 * Tests a merge where all members have views whose ViewIds have the same creator, but different IDs, e.g.:
 * A: A|5 {A}
 * B: A|6 {A,B}
 * C: A|7 {A,B,C}
 */
public void testSameCreatorDifferentIDs() throws Exception {
    for(JChannel ch: new JChannel[]{a,b,c}) {
        MERGE3 merge_prot=(MERGE3)ch.getProtocolStack().findProtocol(MERGE3.class);
        if(merge_prot == null) {
            merge_prot=new MERGE3();
            ch.getProtocolStack().insertProtocol(merge_prot, ProtocolStack.ABOVE, Discovery.class);
            merge_prot.init();
            merge_prot.down(new Event(Event.SET_LOCAL_ADDRESS, ch.getAddress()));
            merge_prot.setMinInterval(2000);
            merge_prot.setMaxInterval(3000);
            merge_prot.setValue("check_interval", 5000);
        }
    }

    View view=View.create(a.getAddress(), 5, a.getAddress());
    injectView(view, a);

    view=View.create(a.getAddress(), 6, a.getAddress(), b.getAddress());
    injectView(view, b);

    view=View.create(a.getAddress(), 7, a.getAddress(), b.getAddress(), c.getAddress());
    injectView(view, c);

    System.out.println("\nA's view: " + a.getView());
    System.out.println("B's view: " + b.getView());
    System.out.println("C's view: " + c.getView());

    Util.waitUntilAllChannelsHaveSameSize(30000, 1000, a,b,c);

    View va=a.getView(), vb=b.getView(), vc=c.getView();
    System.out.println("\nA's view: " + va);
    System.out.println("B's view: " + vb);
    System.out.println("C's view: " + vc);
    assertEquals("A's view is " + va, 3, va.size());
    assertEquals("B's view is " + vb, 3, vb.size());
    assertEquals("C's view is " + vc, 3, vc.size());
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:44,代码来源:OverlappingMergeTest.java

示例11: testCreationAndCoordClose

import org.jgroups.util.Util; //导入方法依赖的package包/类
public void testCreationAndCoordClose() throws Exception {
    a=createChannel(true, 2, "A");
    b=createChannel(a, "B");
    a.connect("testCreationAndCoordClose");
    b.connect("testCreationAndCoordClose");
    Util.waitUntilAllChannelsHaveSameSize(10000,500,a,b);

    a.disconnect();
    Util.waitUntilAllChannelsHaveSameSize(10000,500,b);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:11,代码来源:CloseTest.java

示例12: createChannels

import org.jgroups.util.Util; //导入方法依赖的package包/类
private void createChannels(boolean copy_multicasts, boolean copy_unicasts, int num_outgoing_copies, int num_incoming_copies) throws Exception {
    a=createChannel(true, 3, "A");
    DUPL dupl=new DUPL(copy_multicasts, copy_unicasts, num_incoming_copies, num_outgoing_copies);
    ProtocolStack stack=a.getProtocolStack();
    stack.insertProtocol(dupl,ProtocolStack.BELOW,NAKACK2.class);

    b=createChannel(a, "B");
    c=createChannel(a, "C");

    a.connect("DuplicateTest");
    b.connect("DuplicateTest");
    c.connect("DuplicateTest");

    Util.waitUntilAllChannelsHaveSameSize(20000, 1000,a,b, c);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:16,代码来源:DuplicateTest.java

示例13: createChannels

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeMethod
protected void createChannels() throws Exception {
    a=createChannel(true, 2, "A");
    setBundling(a,MAX_BYTES,LATENCY);
    a.connect("MessageBundlingTest");
    b=createChannel(a, "B");
    r2=new MyReceiver();
    b.setReceiver(r2);
    b.connect("MessageBundlingTest");
    Util.waitUntilAllChannelsHaveSameSize(10000,1000,a,b);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:12,代码来源:MessageBundlingTest.java

示例14: init

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeMethod void init() throws Exception {
    a=createChannel(true, 2).name("A");
    b=createChannel(a).name("B");
    changeNAKACK2(a,b);
    a.connect("LastMessageDroppedTest");
    b.connect("LastMessageDroppedTest");
    Util.waitUntilAllChannelsHaveSameSize(10000,500,a,b);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:9,代码来源:LastMessageDroppedTest.java

示例15: setUp

import org.jgroups.util.Util; //导入方法依赖的package包/类
@BeforeMethod
void setUp() throws Exception {
    System.out.print("Connecting channels: ");
    for(int i=0; i < NUM; i++) {
        channels[i]=Util.createChannel(new SHARED_LOOPBACK(),
                                       new DISCARD(),
                                       new SHARED_LOOPBACK_PING(),
                                       new NAKACK2().setValue("use_mcast_xmit",false)
                                         .setValue("discard_delivered_msgs",true)
                                         .setValue("log_discard_msgs",true).setValue("log_not_found_msgs",true)
                                         .setValue("xmit_table_num_rows",5)
                                         .setValue("xmit_table_msgs_per_row",10),
                                       new UNICAST3().setValue("xmit_table_num_rows",5).setValue("xmit_interval", 300)
                                         .setValue("xmit_table_msgs_per_row",10)
                                         .setValue("conn_expiry_timeout", 10000),
                                       new GMS().setValue("print_local_addr",false)
                                         .setValue("leave_timeout",2000)
                                         .setValue("log_view_warnings",false)
                                         .setValue("view_ack_collection_timeout",2000)
                                         .setValue("log_collect_msgs",false),
                                       new FORWARD_TO_COORD());
        String name=String.valueOf((char)(i + BASE));
        channels[i].setName(name);
        receivers[i]=new MyReceiver();
        channels[i].setReceiver(receivers[i]);
        channels[i].connect("FORWARD_TO_COORD_Test");
        System.out.print(name + " ");
        if(i == 0)
            Util.sleep(1500);
    }
    System.out.println("\n");
    System.out.flush();
    Util.waitUntilAllChannelsHaveSameSize(30000,1000,channels);
}
 
开发者ID:zjumty,项目名称:jgroups-3.6.4-fixed,代码行数:35,代码来源:FORWARD_TO_COORD_Test.java


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