Package org.jgroups.stack

Examples of org.jgroups.stack.ProtocolStack


  private void protocolStackTest() throws Exception {

    logger.info("programmatically create a channel start");
   
    JChannel channel = new JChannel(false);
    ProtocolStack stack = new ProtocolStack();
    channel.setProtocolStack(stack);
   
    stack.addProtocols(new UDP().setValue("bind_addr", InetAddress.getByName("192.168.1.108")))
        .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();
   
   
  }
View Full Code Here


        try {
            mq.reset();

            // new stack is created on open() - bela June 12 2003
            prot_stack=new ProtocolStack(this, props);
            prot_stack.setup();
            closed=false;
        }
        catch(Exception e) {
            throw new ChannelException("failed to open channel" , e);
View Full Code Here

    protected final void init(ProtocolStackConfigurator configurator) throws ChannelException {
        if(log.isInfoEnabled())
            log.info("JGroups version: " + Version.description);
        ConfiguratorFactory.substituteVariables(configurator); // replace vars with system props
        props=configurator.getProtocolStackString();
        prot_stack=new ProtocolStack(this, props);
        try {
            prot_stack.setup(); // Setup protocol stack (create layers, queues between them
        }
        catch(Throwable e) {
            throw new ChannelException("unable to setup the protocol stack", e);
View Full Code Here

        c2_repl.clear();
    }


    private void setCorrectPortRange(Channel ch) {
        ProtocolStack stack=((MuxChannel)ch).getProtocolStack();
        Protocol tcpping=stack.findProtocol("TCPPING");
        if(tcpping == null)
            return;

        Properties props=tcpping.getProperties();
        String port_range=props.getProperty("port_range");
View Full Code Here

   }


   public boolean isSupportStateTransfer() {
      // tests whether state transfer is supported.  We *need* STREAMING_STATE_TRANSFER.
      ProtocolStack stack;
      if (channel != null && (stack = channel.getProtocolStack()) != null) {
         if (stack.findProtocol(STREAMING_STATE_TRANSFER.class) == null) {
            log.error("Channel does not contain STREAMING_STATE_TRANSFER.  Cannot support state transfers!");
            return false;
         }
      } else {
         log.warn("Channel not set up properly!");
View Full Code Here

   }

   public static DISCARD getDiscardForCache(Cache<?, ?> c) throws Exception {
      JGroupsTransport jgt = (JGroupsTransport) TestingUtil.extractComponent(c, Transport.class);
      Channel ch = jgt.getChannel();
      ProtocolStack ps = ch.getProtocolStack();
      DISCARD discard = new DISCARD();
      ps.insertProtocol(discard, ProtocolStack.ABOVE, TP.class);
      return discard;
   }
View Full Code Here

    * @throws Exception
    */
   public static DELAY setDelayForCache(Cache<?, ?> cache, int in_delay_millis, int out_delay_millis) throws Exception {
      JGroupsTransport jgt = (JGroupsTransport) TestingUtil.extractComponent(cache, Transport.class);
      Channel ch = jgt.getChannel();
      ProtocolStack ps = ch.getProtocolStack();
      DELAY delay = new DELAY();
      delay.setInDelay(in_delay_millis);
      delay.setOutDelay(out_delay_millis);
      ps.insertProtocol(delay, ProtocolStack.ABOVE, TP.class);
      return delay;
   }
View Full Code Here

    this.protStack[this.protStack.length-1].setDownProtocol(ad);
    top=protStack[0];
    bottom=this.protStack[this.protStack.length-1];

    try {
      prot_stack=new ProtocolStack();
    } catch (ChannelException e) {          
      e.printStackTrace();
    }

    if(protStack.length > 1) {
View Full Code Here

        this.harness=harness;
        props="LOOPBACK:" + props; // add a loopback layer at the bottom of the stack

        config=new Configurator();
        JChannel mock_channel=new JChannel() {};
        ProtocolStack stack=new ProtocolStack(mock_channel,props);
        stack.setup();
        stack.insertProtocol(harness, ProtocolStack.ABOVE, stack.getTopProtocol().getClass());
       
        bottom=stack.getBottomProtocol();

        // has to be set after StartProtocolStack, otherwise the up and down handler threads in the harness
        // will be started as well (we don't want that) !
        // top.setUpProtocol(harness);
    }
View Full Code Here

            cluster_name=channel != null? channel.getClusterName() : null;
        if(cluster_name == null)
            cluster_name="null";

        if(register_protocols) {
            ProtocolStack stack=channel.getProtocolStack();
            Vector<Protocol> protocols=stack.getProtocols();
            for(Protocol p:protocols) {
                register(p,
                         ManagementFactory.getPlatformMBeanServer(),
                         getProtocolRegistrationName(cluster_name, domain, p));
            }
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.