Search in sources :

Example 41 with JChannel

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

the class FalseSuspicionTest method getTotalSuspectedMembers.

protected int getTotalSuspectedMembers() {
    int total = 0;
    for (JChannel ch : channels) {
        FD_SOCK fd_sock = ch.getProtocolStack().findProtocol(FD_SOCK.class);
        total += fd_sock.getNumSuspectedMembers();
    }
    return total;
}
Also used : JChannel(org.jgroups.JChannel)

Example 42 with JChannel

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

the class LockServiceTest method setProp.

protected static void setProp(Class<? extends Locking> clazz, boolean value, JChannel... channels) {
    for (JChannel ch : channels) {
        Locking prot = ch.getProtocolStack().findProtocol(clazz);
        prot.useThreadIdForLockOwner(value);
    }
}
Also used : JChannel(org.jgroups.JChannel) Locking(org.jgroups.protocols.Locking)

Example 43 with JChannel

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

the class NAKACK_RetransmitTest method stopRetransmission.

protected static void stopRetransmission(JChannel... channels) throws Exception {
    for (JChannel ch : channels) {
        NAKACK2 nak = ch.getProtocolStack().findProtocol(NAKACK2.class);
        STOP_RETRANSMISSION.invoke(nak);
    }
}
Also used : NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) JChannel(org.jgroups.JChannel)

Example 44 with JChannel

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

the class FILE_PING_Test method injectView.

protected static void injectView(JChannel... channels) {
    Address coord = channels[0].getAddress();
    long current_view_id = ((GMS) channels[0].getProtocolStack().findProtocol(GMS.class)).view().getViewId().getId();
    View v = View.create(coord, current_view_id + 1, Stream.of(channels).map(JChannel::getAddress).collect(Collectors.toList()));
    Stream.of(channels).forEach(ch -> ((GMS) ch.getProtocolStack().findProtocol(GMS.class)).installView(v));
}
Also used : JChannel(org.jgroups.JChannel) Address(org.jgroups.Address) GMS(org.jgroups.protocols.pbcast.GMS) View(org.jgroups.View)

Example 45 with JChannel

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

the class TLSTest method verifyForbiddenJoiner.

private void verifyForbiddenJoiner(String name) throws Exception {
    JChannel channel = create(name);
    GMS gms = channel.getProtocolStack().findProtocol(GMS.class);
    gms.setMaxJoinAttempts(1);
    try {
        channel.connect(cluster_name);
    } catch (Exception ex) {
    }
    for (int i = 0; i < 10; i++) {
        if (a.getView().size() > 3)
            break;
        Util.sleep(500);
    }
    Arrays.asList(a, b, c).forEach(ch -> {
        View view = ch.getView();
        assertEquals(3, view.size());
        assertTrue(view.containsMembers(a.getAddress(), b.getAddress(), c.getAddress()));
    });
}
Also used : JChannel(org.jgroups.JChannel) GMS(org.jgroups.protocols.pbcast.GMS) View(org.jgroups.View) KeyStoreException(java.security.KeyStoreException)

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