Package org.jgroups.protocols

Examples of org.jgroups.protocols.TP$Bundler


        if(channel != null) {
            Vector tmp_mbrs=channel.getView() != null ? channel.getView().getMembers() : null;
            setMembers(tmp_mbrs);
            if(channel instanceof JChannel) {
                TP transport=channel.getProtocolStack().getTransport();
                corr.registerProbeHandler(transport);
            }
            TP transport=channel.getProtocolStack().getTransport();
            hardware_multicast_supported=transport.supportsMulticasting();
        }
    }
View Full Code Here


        if(corr != null) {
            corr.stop();
        }

        if(channel instanceof JChannel) {
            TP transport=channel.getProtocolStack().getTransport();
            corr.unregisterProbeHandler(transport);
        }

        // fixes leaks of MembershipListeners (http://jira.jboss.com/jira/browse/JGRP-160)
        if(adapter != null && handler != null) {
View Full Code Here

     * @return the number of messages sent across the network
     * @throws Exception
     */
    private static long getNumMessagesSentViaNetwork(JChannel ch) throws Exception {

      TP transport = ch.getProtocolStack().getTransport();
      if (transport == null) {
        throw new Exception("transport layer is not present - check default stack configuration") ;
      }

      return transport.getNumMessagesSent();
    }
View Full Code Here

     * @param loopback
     * @throws Exception
     */
    private static void setLoopbackProperty(JChannel ch, boolean loopback) throws Exception {

      TP transport =ch.getProtocolStack().getTransport();
      if (transport == null) {
        throw new Exception("transport layer is not present - check default stack configuration") ;
      }

      // check if already set correctly
      if ((loopback && transport.isLoopback()) || (!loopback && !transport.isLoopback()))
        return ;

      // otherwise, set it
      transport.setLoopback(loopback);
    }
View Full Code Here

    public void testOOBMessageLoss() throws ChannelNotConnectedException, ChannelClosedException {
        Util.close(c2); // we only need 1 channel
        MyReceiver receiver=new MySleepingReceiver("C1", 1000);
        c1.setReceiver(receiver);

        TP transport=c1.getProtocolStack().getTransport();
        transport.setOOBRejectionPolicy("discard");

        final int NUM=10;

        for(int i=1; i <= NUM; i++) {
            Message msg=new Message(null, null, i);
View Full Code Here

    }


    private static void setOOBPoolSize(JChannel... channels) {
        for(Channel channel: channels) {
            TP transport=channel.getProtocolStack().getTransport();
            transport.setOOBThreadPoolMinThreads(1);
            transport.setOOBThreadPoolMaxThreads(2);
        }
    }
View Full Code Here

    }


    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");
View Full Code Here

   {
      log.info("+++ testThreadPoolConfig()");     
     
      channel1 = factory1.createChannel("queues");
      channel1.connect("test");
      TP tp1 = getTP((JChannel) channel1);
     
      /*
       * Access to these properties is deprecated.
       *
       * assertEquals(3000, tp1.getIncomingKeepAliveTime());
      assertEquals(22, tp1.getIncomingMaxPoolSize());
      assertEquals(2, tp1.getIncomingMinPoolSize());
      assertEquals(750, tp1.getIncomingMaxQueueSize());
      assertEquals(4000, tp1.getOOBKeepAliveTime());
      assertEquals(12, tp1.getOOBMaxPoolSize());
      assertEquals(3, tp1.getOOBMinPoolSize());
      assertEquals(75, tp1.getOOBMaxQueueSize());*/
     
      Executor exec = tp1.getDefaultThreadPool();
      assertNotNull(exec);
     
      exec = tp1.getOOBThreadPool();
      assertNotNull(exec);
     
      // Confirm that the no-pool config doesn't create a pool
      channel2 = factory1.createChannel("nonconcurrent1");
      channel2.connect("test");
      TP tp2 = getTP((JChannel) channel2);
     
      assertFalse(tp2.getDefaultThreadPool() instanceof ThreadPoolExecutor);
      assertFalse(tp2.getOOBThreadPool() instanceof ThreadPoolExecutor);
   }
View Full Code Here

         }
      }
     
      // Validate that the overrides actuall affect created channels
      channel1 = factory.createChannel("unshared1");
      TP transport = (TP)((JChannel) channel1).getProtocolStack().findProtocol("UDP");     
      assertEquals(50000, transport.getMaxBundleSize());
      channel2 = factory.createChannel("added")
      transport = (TP)((JChannel) channel2).getProtocolStack().findProtocol("UDP");
      assertEquals(64000,transport.getMaxBundleSize());
      try
      {
         factory.createChannel("shared2");
         fail("should not be able to create a channel for 'shared2'");
      }
View Full Code Here

      assertTrue("no singleton_name in unshared2", cfg2.indexOf("singleton_name") < 0);
     
      channel1 = factory1.createChannel("unshared1");
      assertFalse(channel1 instanceof MuxChannel);
      channel1.connect("test");     
      TP tp1 = getTP((JChannel) channel1);
     
      channel2 = factory2.createChannel("unshared2");
      assertFalse(channel2 instanceof MuxChannel);
      channel2.connect("test");
      TP tp2 = getTP((JChannel) channel2);
     
      assertNotSame(tp1, tp2);
     
      channel3 = factory1.createMultiplexerChannel("unshared1", "test");
      assertFalse(channel3 instanceof MuxChannel);
      // JBAS-7015 use unique name
      //channel3.connect("test");
      channel3.connect("test3");
      TP tp3 = getTP((JChannel) channel3);
     
      //JBAS-7015 -- change assert
      //assertNotSame(tp1, tp3);
      assertSame(tp1, tp3);
      assertNotSame(tp2, tp3);
     
      channel4 = factory1.createMultiplexerChannel("unshared1", "test2");
      assertFalse(channel4 instanceof MuxChannel);
      channel4.connect("test4");
      TP tp4 = getTP((JChannel) channel4);
     
      assertSame(tp3, tp4);
   }
View Full Code Here

TOP

Related Classes of org.jgroups.protocols.TP$Bundler

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.