Search in sources :

Example 21 with STABLE

use of org.jgroups.protocols.pbcast.STABLE in project JGroups by belaban.

the class LastMessageDroppedTest method changeDesiredGossipTime.

protected static void changeDesiredGossipTime(long avg_desired_gossip, JChannel... channels) {
    for (JChannel ch : channels) {
        STABLE stable = ch.getProtocolStack().findProtocol(STABLE.class);
        stable.setDesiredAverageGossip(avg_desired_gossip);
    }
}
Also used : STABLE(org.jgroups.protocols.pbcast.STABLE)

Example 22 with STABLE

use of org.jgroups.protocols.pbcast.STABLE in project JGroups by belaban.

the class TUNNEL_Test method createTunnelChannel.

protected JChannel createTunnelChannel(String name, boolean include_failure_detection) throws Exception {
    TUNNEL tunnel = new TUNNEL().setBindAddress(gossip_router_bind_addr);
    FD_ALL3 fd_all = new FD_ALL3().setTimeout(2000).setInterval(500);
    tunnel.setGossipRouterHosts(gossip_router_hosts);
    List<Protocol> protocols = new ArrayList<>(Arrays.asList(tunnel, new PING(), new MERGE3().setMinInterval(1000).setMaxInterval(3000)));
    if (include_failure_detection) {
        List<Protocol> tmp = new ArrayList<>(2);
        tmp.add(fd_all);
        tmp.add(new VERIFY_SUSPECT());
        protocols.addAll(tmp);
    }
    protocols.addAll(Arrays.asList(new NAKACK2().useMcastXmit(false), new UNICAST3(), new STABLE(), new GMS().setJoinTimeout(1000)));
    JChannel ch = new JChannel(protocols);
    if (name != null)
        ch.setName(name);
    return ch;
}
Also used : ArrayList(java.util.ArrayList) GMS(org.jgroups.protocols.pbcast.GMS) NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) STABLE(org.jgroups.protocols.pbcast.STABLE) Protocol(org.jgroups.stack.Protocol)

Example 23 with STABLE

use of org.jgroups.protocols.pbcast.STABLE in project JGroups by belaban.

the class TUNNELDeadLockTest method createTunnelChannel.

protected JChannel createTunnelChannel(String name) throws Exception {
    TUNNEL tunnel = new TUNNEL().setBindAddress(InetAddress.getByName(bind_addr));
    tunnel.setGossipRouterHosts(gossip_router_hosts);
    JChannel ch = new JChannel(tunnel, new PING(), new NAKACK2(), new UNICAST3(), new STABLE(), new GMS().setJoinTimeout(1000)).name(name);
    if (name != null)
        ch.setName(name);
    return ch;
}
Also used : TUNNEL(org.jgroups.protocols.TUNNEL) NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) PING(org.jgroups.protocols.PING) STABLE(org.jgroups.protocols.pbcast.STABLE) GMS(org.jgroups.protocols.pbcast.GMS) UNICAST3(org.jgroups.protocols.UNICAST3)

Example 24 with STABLE

use of org.jgroups.protocols.pbcast.STABLE in project JGroups by belaban.

the class ProgrammaticUPerf method init.

public void init(String name, AddressGenerator generator, String bind_addr, int bind_port, boolean udp, String mcast_addr, int mcast_port, String initial_hosts) throws Throwable {
    InetAddress bind_address = bind_addr != null ? Util.getAddress(bind_addr, Util.getIpStackType()) : Util.getLoopback();
    Protocol[] prot_stack = { // transport
    null, // discovery protocol
    null, new MERGE3(), new FD_SOCK(), new FD_ALL3(), new VERIFY_SUSPECT(), new NAKACK2(), new UNICAST3(), new STABLE(), new GMS().setJoinTimeout(1000), new UFC(), new MFC(), new FRAG4() };
    if (udp) {
        UDP u = new UDP().setMulticastAddress(InetAddress.getByName(mcast_addr)).setMulticastPort(mcast_port);
        u.getDiagnosticsHandler().setMcastAddress(InetAddress.getByName("224.0.75.75")).enableUdp(true);
        prot_stack[0] = u;
        prot_stack[1] = new PING();
    } else {
        if (initial_hosts == null) {
            InetAddress host = bind_addr == null ? InetAddress.getLocalHost() : Util.getAddress(bind_addr, Util.getIpStackType());
            initial_hosts = String.format("%s[%d]", host.getHostAddress(), bind_port);
        }
        TCP tcp = new TCP();
        tcp.getDiagnosticsHandler().enableUdp(false).enableTcp(true);
        prot_stack[0] = tcp;
        prot_stack[1] = new TCPPING().setInitialHosts2(Util.parseCommaDelimitedHosts(initial_hosts, 2));
    }
    ((TP) prot_stack[0]).setBindAddress(bind_address).setBindPort(bind_port);
    channel = new JChannel(prot_stack).addAddressGenerator(generator).setName(name);
    TP transport = channel.getProtocolStack().getTransport();
    // todo: remove default ProbeHandler for "jmx" and "op"
    NonReflectiveProbeHandler h = new NonReflectiveProbeHandler(channel);
    transport.registerProbeHandler(h);
    h.initialize(channel.getProtocolStack().getProtocols());
    // System.out.printf("contents:\n%s\n", h.dump());
    disp = new RpcDispatcher(channel, this).setReceiver(this).setMethodInvoker(this);
    channel.connect(groupname);
    local_addr = channel.getAddress();
    if (members.size() < 2)
        return;
    Address coord = members.get(0);
    Config config = disp.callRemoteMethod(coord, new CustomCall(GET_CONFIG), new RequestOptions(ResponseMode.GET_ALL, 5000));
    if (config != null) {
        applyConfig(config);
        System.out.println("Fetched config from " + coord + ": " + config + "\n");
    } else
        System.err.println("failed to fetch config from " + coord);
}
Also used : InetAddress(java.net.InetAddress) STABLE(org.jgroups.protocols.pbcast.STABLE) Protocol(org.jgroups.stack.Protocol) NonReflectiveProbeHandler(org.jgroups.stack.NonReflectiveProbeHandler) GMS(org.jgroups.protocols.pbcast.GMS) NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) InetAddress(java.net.InetAddress)

Example 25 with STABLE

use of org.jgroups.protocols.pbcast.STABLE in project JGroups by belaban.

the class DynamicDiscardTest method testLeaveDuringSend.

public void testLeaveDuringSend() throws Exception {
    final JChannel[] channels = new JChannel[NUM];
    final MessageDispatcher[] dispatchers = new MessageDispatcher[NUM];
    for (int i = 0; i < NUM; i++) {
        channels[i] = new JChannel(new SHARED_LOOPBACK(), new SHARED_LOOPBACK_PING(), new MERGE3(), new FD_ALL3().setTimeout(1000).setInterval(300), new NAKACK2(), new UNICAST3(), new STABLE(), new GMS(), new RSVP().ackOnDelivery(false).throwExceptionOnTimeout(false));
        channels[i].setName(Character.toString((char) ('A' + i)));
        channels[i].setDiscardOwnMessages(true);
        dispatchers[i] = new MessageDispatcher(channels[i], new MyRequestHandler());
        dispatchers[i].setReceiver(new MyMembershipListener(channels[i]));
        channels[i].connect("DynamicDiscardTest");
        System.out.print(i + 1 + " ");
    }
    Util.waitUntilAllChannelsHaveSameView(10000, 1000, channels);
    // discard all messages (except those to self)
    DISCARD discard = new DISCARD().discardAll(true);
    channels[0].getProtocolStack().insertProtocol(discard, ProtocolStack.Position.ABOVE, TP.class);
    // send a RSVP message
    byte[] data = "message2".getBytes();
    ByteArray buf = new ByteArray(data, 0, data.length);
    RspList<Object> rsps = dispatchers[0].castMessage(null, new BytesMessage(null, buf), RequestOptions.SYNC().timeout(5000).flags(Message.Flag.RSVP, Message.Flag.OOB));
    Rsp<Object> objectRsp = rsps.get(channels[1].getAddress());
    assertFalse(objectRsp.wasReceived());
    assertTrue(objectRsp.wasSuspected());
}
Also used : GMS(org.jgroups.protocols.pbcast.GMS) NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) MessageDispatcher(org.jgroups.blocks.MessageDispatcher) ByteArray(org.jgroups.util.ByteArray) STABLE(org.jgroups.protocols.pbcast.STABLE)

Aggregations

STABLE (org.jgroups.protocols.pbcast.STABLE)34 NAKACK2 (org.jgroups.protocols.pbcast.NAKACK2)29 GMS (org.jgroups.protocols.pbcast.GMS)27 JChannel (org.jgroups.JChannel)15 Protocol (org.jgroups.stack.Protocol)13 UNICAST3 (org.jgroups.protocols.UNICAST3)6 ArrayList (java.util.ArrayList)4 SHARED_LOOPBACK (org.jgroups.protocols.SHARED_LOOPBACK)3 DISCARD (org.jgroups.protocols.DISCARD)2 SHARED_LOOPBACK_PING (org.jgroups.protocols.SHARED_LOOPBACK_PING)2 TCP (org.jgroups.protocols.TCP)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 Test (org.testng.annotations.Test)2 InetAddress (java.net.InetAddress)1 InetSocketAddress (java.net.InetSocketAddress)1 SecureRandom (java.security.SecureRandom)1 List (java.util.List)1 Properties (java.util.Properties)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1