Search in sources :

Example 86 with JChannel

use of org.jgroups.JChannel in project JGroups by belaban.

the class RpcDispatcherAsyncInvocationTest method createChannel.

protected static JChannel createChannel(String name) throws Exception {
    SHARED_LOOPBACK sl = new SHARED_LOOPBACK();
    sl.getThreadPool().setMinThreads(10).setMaxThreads(20);
    return new JChannel(sl, new SHARED_LOOPBACK_PING(), new NAKACK2(), new UNICAST3(), new GMS()).name(name);
}
Also used : SHARED_LOOPBACK(org.jgroups.protocols.SHARED_LOOPBACK) NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) JChannel(org.jgroups.JChannel) SHARED_LOOPBACK_PING(org.jgroups.protocols.SHARED_LOOPBACK_PING) GMS(org.jgroups.protocols.pbcast.GMS) UNICAST3(org.jgroups.protocols.UNICAST3)

Example 87 with JChannel

use of org.jgroups.JChannel in project JGroups by belaban.

the class TCPGOSSIP_Test method testConnectThreeChannelsWithGRDown.

public void testConnectThreeChannelsWithGRDown() throws Exception {
    JChannel third = null;
    try {
        coordinator = createTcpgossipChannel("A");
        channel = createTcpgossipChannel("B");
        coordinator.connect("testConnectThreeChannelsWithGRDown");
        channel.connect("testConnectThreeChannelsWithGRDown");
        // kill router
        gossipRouter.stop();
        // cannot discover others since GR is down
        third = createTcpgossipChannel("C");
        third.connect("testConnectThreeChannelsWithGRDown");
        // restart and....
        gossipRouter.start();
        Util.waitUntilAllChannelsHaveSameView(60000, 1000, coordinator, channel, third);
        // confirm they found each other
        View view = channel.getView();
        assert channel.getView().size() == 3;
        assert third.getView().size() == 3;
        assert view.containsMember(channel.getAddress());
        assert view.containsMember(coordinator.getAddress());
    } finally {
        Util.close(third);
    }
}
Also used : JChannel(org.jgroups.JChannel) View(org.jgroups.View)

Example 88 with JChannel

use of org.jgroups.JChannel in project JGroups by belaban.

the class ReplicatedHashMapTest method setUp.

@BeforeClass
protected void setUp() throws Exception {
    JChannel c1 = createChannel();
    this.map1 = new ReplicatedHashMap<>(c1);
    map1.setBlockingUpdates(true);
    JChannel c2 = createChannel();
    this.map2 = new ReplicatedHashMap<>(wrap, c2);
    map2.setBlockingUpdates(true);
    makeUnique(c1, c2);
    c1.connect("ReplicatedHashMapTest");
    this.map1.start(5000);
    c2.connect("ReplicatedHashMapTest");
    this.map2.start(5000);
}
Also used : JChannel(org.jgroups.JChannel) BeforeClass(org.testng.annotations.BeforeClass)

Example 89 with JChannel

use of org.jgroups.JChannel in project JGroups by belaban.

the class TCPGOSSIP_Test method testConnectThree.

public void testConnectThree() throws Exception {
    JChannel third = null;
    try {
        coordinator = createTcpgossipChannel("A");
        channel = createTcpgossipChannel("B");
        coordinator.connect(GROUP);
        channel.connect(GROUP);
        third = createTcpgossipChannel("C");
        third.connect(GROUP);
        Util.waitUntilAllChannelsHaveSameView(10000, 500, coordinator, channel, third);
        View view = channel.getView();
        assert channel.getView().size() == 3 : String.format("expected view size of 3 but got %d: %s", channel.getView().size(), channel.getView());
        assert third.getView().size() == 3;
        assert view.containsMember(channel.getAddress());
        assert view.containsMember(coordinator.getAddress());
    } finally {
        Util.close(third);
    }
}
Also used : JChannel(org.jgroups.JChannel) View(org.jgroups.View)

Example 90 with JChannel

use of org.jgroups.JChannel in project JGroups by belaban.

the class FalseSuspicionTest method testFalseSuspicion.

public void testFalseSuspicion() throws Exception {
    JChannel e = channels[channels.length - 1];
    FD_SOCK fd_sock = e.getProtocolStack().findProtocol(FD_SOCK.class);
    System.out.println("*** suspecting " + channels[1].getAddress());
    suspect_method.invoke(fd_sock, channels[1].getAddress());
    for (int i = 0; i < 10; i++) {
        if (getTotalSuspectedMembers() == 0)
            break;
        Util.sleep(1000);
    }
    assert getTotalSuspectedMembers() == 0;
}
Also used : JChannel(org.jgroups.JChannel)

Aggregations

JChannel (org.jgroups.JChannel)119 GMS (org.jgroups.protocols.pbcast.GMS)22 NAKACK2 (org.jgroups.protocols.pbcast.NAKACK2)21 Protocol (org.jgroups.stack.Protocol)18 STABLE (org.jgroups.protocols.pbcast.STABLE)15 View (org.jgroups.View)14 Message (org.jgroups.Message)10 ArrayList (java.util.ArrayList)9 Address (org.jgroups.Address)7 IOException (java.io.IOException)6 Test (org.testng.annotations.Test)5 InetSocketAddress (java.net.InetSocketAddress)4 HashMap (java.util.HashMap)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)4 DistributedSystemDisconnectedException (org.apache.geode.distributed.DistributedSystemDisconnectedException)4 LockService (org.jgroups.blocks.locking.LockService)4 Test (org.junit.Test)4 BeforeMethod (org.testng.annotations.BeforeMethod)4 CountDownLatch (java.util.concurrent.CountDownLatch)3 ChannelBroadcastEndpointFactory (org.apache.activemq.artemis.api.core.ChannelBroadcastEndpointFactory)3