Package org.jgroups.stack

Examples of org.jgroups.stack.ProtocolStack$PatternedThreadFactory


        assert msg != null;
        assert "payload".equals(msg.getObject());
    }

    private static void setProps(JChannel channel) {
        ProtocolStack stack=channel.getProtocolStack();
        MERGE2 merge=(MERGE2)stack.findProtocol(MERGE2.class);
        if(merge != null) {
            merge.setMinInterval(1000);
            merge.setMaxInterval(3000);
        }
        FD fd=(FD)stack.findProtocol(FD.class);
        if(fd != null) {
            fd.setTimeout(1000);
            fd.setMaxTries(2);
        }
        FD_ALL fd_all=(FD_ALL)stack.findProtocol(FD_ALL.class);
        if(fd_all != null) {
            fd_all.setTimeout(2000);
            fd_all.setInterval(600);
        }
    }
View Full Code Here


    }


    private static void modifyConfigs(JChannel ... channels) throws Exception {
        for(JChannel ch: channels) {
            ProtocolStack stack=ch.getProtocolStack();
            stack.removeProtocol("MERGE2");
            stack.removeProtocol("FC");
            stack.removeProtocol("VERIFY_SUSPECT");
            NAKACK nak=(NAKACK)stack.findProtocol(NAKACK.class);
            if(nak != null)
                nak.setLogDiscardMessages(false);
        }
    }
View Full Code Here

        }
    }


    private static void changeViewBundling(JChannel channel) {
        ProtocolStack stack=channel.getProtocolStack();
        GMS gms=(GMS)stack.findProtocol(GMS.class);
        if(gms != null) {
            gms.setViewBundling(true);
            gms.setMaxBundlingTime(500);
        }
    }
View Full Code Here

            gms.setMaxBundlingTime(500);
        }
    }

    private static void changeMergeInterval(JChannel channel) {
        ProtocolStack stack=channel.getProtocolStack();
        MERGE2 merge=(MERGE2)stack.findProtocol(MERGE2.class);
        if(merge != null) {
            merge.setMinInterval(5000);
            merge.setMaxInterval(10000);
        }
    }
View Full Code Here

            merge.setMaxInterval(10000);
        }
    }
   
    private static void replaceDiscoveryProtocol(JChannel ch) throws Exception {
        ProtocolStack stack=ch.getProtocolStack();
        Protocol discovery=stack.removeProtocol("TCPPING");
        if(discovery != null){
            Protocol transport = stack.getTransport();
            MPING mping=new MPING();
            InetAddress bindAddress=Util.getBindAddress(new Properties());
            mping.setBindAddr(bindAddress);
            mping.setMulticastAddress("230.1.2.3");
            mping.setMcastPort(8888);           
            stack.insertProtocol(mping, ProtocolStack.ABOVE, transport.getName());
            mping.setProtocolStack(ch.getProtocolStack());
            mping.init();
            mping.start();           
            System.out.println("Replaced TCPPING with MPING. See http://wiki.jboss.org/wiki/Wiki.jsp?page=JGroupsMERGE2");           
        }       
View Full Code Here


    public static void addFlush(Channel ch, FLUSH flush) {
        if(ch == null || flush == null)
            throw new IllegalArgumentException("ch and flush have to be non-null");
        ProtocolStack stack=ch.getProtocolStack();
        stack.insertProtocolAtTop(flush);
    }
View Full Code Here

     * the view until failure detection has kicked in and the new coord installed the new view */
    public static void shutdown(Channel ch) throws Exception {
        DISCARD discard=new DISCARD();
        discard.setLocalAddress(ch.getAddress());
        discard.setDiscardAll(true);
        ProtocolStack stack=ch.getProtocolStack();
        TP transport=stack.getTransport();
        stack.insertProtocol(discard,  ProtocolStack.ABOVE, transport.getClass());
       
        //abruptly shutdown FD_SOCK just as in real life when member gets killed non gracefully
        FD_SOCK fd = (FD_SOCK) ch.getProtocolStack().findProtocol("FD_SOCK");
        if(fd != null)
            fd.stopServerSocket(false);
       
        View view=ch.getView();
        if (view != null) {
            ViewId vid = view.getViewId();
            List<Address> members = Arrays.asList(ch.getAddress());

            ViewId new_vid = new ViewId(ch.getAddress(), vid.getId() + 1);
            View new_view = new View(new_vid, members);

            // inject view in which the shut down member is the only element
            GMS gms = (GMS) stack.findProtocol(GMS.class);
            gms.installView(new_view);
        }
        Util.close(ch);
    }
View Full Code Here


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

    }


    protected static JChannel createChannel() throws Exception {
        JChannel ch=new JChannel(false);
        ProtocolStack stack=new ProtocolStack();
        ch.setProtocolStack(stack);
        stack.addProtocol(new SHARED_LOOPBACK().setValue("oob_thread_pool_rejection_policy", "run")
                            .setValue("thread_pool_rejection_policy", "run")
                            .setValue("thread_pool_queue_max_size", 100000))
          .addProtocol(new PING())
          .addProtocol(new MERGE2())
          .addProtocol(new FD_SOCK())
          .addProtocol(new VERIFY_SUSPECT())
          .addProtocol(new BARRIER())
          .addProtocol(new NAKACK().setValue("use_mcast_xmit", false).setValue("discard_delivered_msgs", true))
          .addProtocol(new UNICAST2().setValue("stable_interval", 10000).setValue("max_bytes", 50000))
          .addProtocol(new STABLE().setValue("max_bytes", 50000))
          .addProtocol(new GMS().setValue("print_local_addr", false))
          .addProtocol(new UFC().setValue("max_credits", 2000000))
          .addProtocol(new MFC().setValue("max_credits", 2000000))
          .addProtocol(new FRAG2());
        stack.init();
        return ch;
    }
View Full Code Here

        View view=ch2.getView();
        assert view.size() == 2 : " view=" + view;
    }

    private static void setLoopback(JChannel ch, boolean b) {
        ProtocolStack stack=ch.getProtocolStack();
        List<Protocol> prots=stack.getProtocols();
        TP transport=(TP)prots.get(prots.size() -1);
        transport.setLoopback(b);
    }
View Full Code Here

TOP

Related Classes of org.jgroups.stack.ProtocolStack$PatternedThreadFactory

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.