Package org.jgroups.stack

Examples of org.jgroups.stack.ProtocolStack




    private void sendMessages(Address dest, boolean use_scopes) throws Exception {
        if(use_scopes) {
            ProtocolStack stack=c2.getProtocolStack();
            Protocol neighbor=stack.findProtocol(UNICAST.class, UNICAST2.class);
            SCOPE scope=new SCOPE();
            stack.insertProtocolInStack(scope, neighbor, ProtocolStack.ABOVE);
            scope.init();
        }

        c1.connect("SCOPE_Test");
        c2.connect("SCOPE_Test");
View Full Code Here


    static void log(String msg) {
        System.out.println(" -- "+ msg);
    }

    private static void modifyStack(JChannel ch) {
        ProtocolStack stack=ch.getProtocolStack();
        GMS gms=(GMS)stack.findProtocol(GMS.class);
        if(gms != null)
            gms.setLogCollectMessages(false);
    }
View Full Code Here

        DISCARD_PAYLOAD prot1=new DISCARD_PAYLOAD();
        MyReceiver receiver=new MyReceiver();
        c2.setReceiver(receiver);

        // the first channel will discard the unicast messages with seqno #3 two times, the let them pass down
        ProtocolStack stack=c1.getProtocolStack();
        Protocol neighbor=stack.findProtocol(UNICAST.class, UNICAST2.class);
        System.out.println("Found unicast protocol " + neighbor.getClass().getSimpleName());
        stack.insertProtocolInStack(prot1, neighbor, ProtocolStack.BELOW);

        c1.connect("UNICAST_OOB_Test");
        c2.connect("UNICAST_OOB_Test");
        assert c2.getView().size() == 2 : "ch2.view is " + c2.getView();
View Full Code Here


    private void createChannels(boolean copy_multicasts, boolean copy_unicasts, int num_outgoing_copies, int num_incoming_copies) throws Exception {
        c1=createChannel(true, 3);
        DUPL dupl=new DUPL(copy_multicasts, copy_unicasts, num_incoming_copies, num_outgoing_copies);
        ProtocolStack stack=c1.getProtocolStack();
        stack.insertProtocol(dupl, ProtocolStack.BELOW, NAKACK.class);

        c2=createChannel(c1);
        c3=createChannel(c1);

        c1.connect("DuplicateTest");
View Full Code Here

            disconnected.await();
        }
    }

    private static void modifyStack(JChannel ch) {
        ProtocolStack stack=ch.getProtocolStack();
        Protocol prot=stack.findProtocol(MERGE2.class);
        if(prot != null) {
            MERGE2 merge=(MERGE2)prot;
            merge.setMinInterval(3000);
            merge.setMaxInterval(5000);
        }
        prot=stack.findProtocol(STABLE.class);
        if(prot != null) {
            STABLE stable=(STABLE)prot;
            stable.setDesiredAverageGossip(5000);
        }
        prot=stack.findProtocol(NAKACK.class);
        if(prot != null) {
            ((NAKACK)prot).setLogDiscardMessages(false);
        }
        prot=stack.findProtocol(FD_SOCK.class);
        if(prot != null) {
            ((FD_SOCK)prot).setLogSuspectedMessages(false);
        }
    }
View Full Code Here

    void _testDelayedJoinResponse(long discovery_timeout, long join_timeout,
                                  long delay_join_req, long tolerance) throws Exception {
        c1.connect("JoinTest");
        c2.connect("JoinTest");

        ProtocolStack stack=c2.getProtocolStack();
        GMS gms=(GMS)stack.findProtocol("GMS");
        if(gms != null) {
            gms.setJoinTimeout(join_timeout);
        }

        Discovery discovery=(Discovery)stack.findProtocol(Discovery.class);       
        if(discovery != null) {
            discovery.setNumInitialMembers(10);
            discovery.setTimeout(discovery_timeout);
        }

        stack=c1.getProtocolStack();
        DELAY_JOIN_REQ delay=new DELAY_JOIN_REQ();
        delay.setDelay(delay_join_req);
        stack.insertProtocol(delay, ProtocolStack.BELOW, "GMS");

        System.out.println(new Date() + ": joining c2");
        long start=System.currentTimeMillis(), stop;
        c2.connect("JoinTest-2");
        stop=System.currentTimeMillis();
View Full Code Here

           
  List<String> order = new LinkedList<String>() ;

  @BeforeMethod
  void setUp() {
    stack=new ProtocolStack();
  }
View Full Code Here

        return new JChannel(config);
    }


    protected static void makeUnique(Channel channel, int num) throws Exception {
        ProtocolStack stack=channel.getProtocolStack();
        TP transport=stack.getTransport();
        InetAddress bind_addr=transport.getBindAddressAsInetAddress();

        if(transport instanceof UDP) {
            String mcast_addr=ResourceManager.getNextMulticastAddress();
            short mcast_port=ResourceManager.getNextMulticastPort(bind_addr);
            ((UDP)transport).setMulticastAddress(InetAddress.getByName(mcast_addr));
            ((UDP)transport).setMulticastPort(mcast_port);
        }
        else if(transport instanceof BasicTCP) {
            List<Short> ports=ResourceManager.getNextTcpPorts(bind_addr, num);
            transport.setBindPort(ports.get(0));
            transport.setPortRange(num);

            Protocol ping=stack.findProtocol(TCPPING.class);
            if(ping == null)
                throw new IllegalStateException("TCP stack must consist of TCP:TCPPING - other config are not supported");

            List<String> initial_hosts=new LinkedList<String>();
            for(short port: ports) {
View Full Code Here

  static final String BIND_ADDR = "192.168.1.101" ;

  public static void main(String[] args) throws Exception {

    JChannel channel = new JChannel(false);
    ProtocolStack stack = new ProtocolStack();
    channel.setProtocolStack(stack);
   
    stack.addProtocols(new UDP().setValue("bind_addr", InetAddress.getByName(BIND_ADDR)))
        .addProtocol(new PING())
        .addProtocol(new MERGE2())
        .addProtocol(new FD_SOCK())
        .addProtocol(new FD_ALL().setValue("timeout", 12000).setValue("interval", 3000))
        .addProtocol(new VERIFY_SUSPECT()).addProtocol(new BARRIER())
        .addProtocol(new NAKACK()).addProtocol(new UNICAST2())
        .addProtocol(new STABLE()).addProtocol(new GMS())
        .addProtocol(new UFC()).addProtocol(new MFC())
        .addProtocol(new FRAG2());
    stack.init();
   
    channel.setReceiver(new ReceiverAdapter(){

      public void receive(Message msg) {
        Address sender=msg.getSrc();
View Full Code Here

            case MPerfHeader.CONFIG_RSP:
                handleConfigResponse((Configuration)msg.getObject());
                break;

            case MPerfHeader.EXIT:
                ProtocolStack stack=channel.getProtocolStack();
                String cluster_name=channel.getClusterName();
                try {
                    JmxConfigurator.unregisterChannel(channel, Util.getMBeanServer(), "jgroups", "mperf");
                }
                catch(Exception e) {
                }
                stack.stopStack(cluster_name);
                stack.destroy();
                break;

            case MPerfHeader.NEW_CONFIG:
                applyNewConfig(msg.getBuffer());
                break;
View Full Code Here

TOP

Related Classes of org.jgroups.stack.ProtocolStack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.