Package org.jgroups.util

Examples of org.jgroups.util.DefaultThreadFactory


        TCPConnectionMap.Receiver dummy=new TCPConnectionMap.Receiver() {
            public void receive(Address sender, byte[] data, int offset, int length) {}
        };

        ct1=new TCPConnectionMap("ConnectionMapTest1",
                                 new DefaultThreadFactory(Util.getGlobalThreadGroup(), "ConnectionMapTest", true),
                                 null, dummy, loopback_addr, null, PORT1, PORT1);
        ct1.start();
       
        ct2=new TCPConnectionMap("ConnectionMapTest2",
                                 new DefaultThreadFactory(Util.getGlobalThreadGroup(), "ConnectionMapTest", true),
                                 null, dummy, loopback_addr, null, PORT2, PORT2);
        ct2.start();
       
        int num_conns;
        num_conns=ct1.getNumConnections();
View Full Code Here


    }


    public void testStopConnectionMapNoSendQueues() throws Exception {
        ct1=new TCPConnectionMap("ConnectionMapTest1",
                                 new DefaultThreadFactory(Util.getGlobalThreadGroup(), "ConnectionMapTest", true),
                                 new DummyReceiver(), loopback_addr, null, PORT1, PORT1, 60000, 120000);
        ct1.setUseSendQueues(false);
        ct1.start();
        ct2=new TCPConnectionMap("ConnectionMapTest2",
                                 new DefaultThreadFactory(Util.getGlobalThreadGroup(), "ConnectionMapTest", true),
                                 new DummyReceiver(), loopback_addr, null, PORT2, PORT2, 60000, 120000);
        ct2.setUseSendQueues(false);
        ct2.start();
        _testStop(ct1, ct2);
    }
View Full Code Here

        _testStop(ct1, ct2);
    }

    public void testStopConnectionMapWithSendQueues() throws Exception {
        ct1=new TCPConnectionMap("ConnectionMapTest1",
                                 new DefaultThreadFactory(Util.getGlobalThreadGroup(), "ConnectionMapTest", true),
                                 new DummyReceiver(), loopback_addr, null, PORT1, PORT1, 60000, 120000);
        ct1.start();
        ct2=new TCPConnectionMap("ConnectionMapTest2",
                                 new DefaultThreadFactory(Util.getGlobalThreadGroup(), "ConnectionMapTest", true),
                                 new DummyReceiver(), loopback_addr, null, PORT2, PORT2, 60000, 120000);
        ct2.start();
        _testStop(ct1, ct2);
    }
View Full Code Here

    private static final String BASE="base";
    private static final String ADDR="192.168.1.5:12345";
    private static final String CLUSTER="MyCluster";

    public void testNoNumbering() {
        factory=new DefaultThreadFactory(null, BASE, true, false);
        Thread thread=factory.newThread(new MyRunnable(), BASE);
        String name=thread.getName();
        System.out.println("name = " + name);
        assert name.equals(BASE);
    }
View Full Code Here

        System.out.println("name = " + name);
        assert name.equals(BASE);
    }

    public void testNumbering() {
        factory=new DefaultThreadFactory(null, BASE, true, true);
        Thread thread=factory.newThread(new MyRunnable(), BASE);
        String name=thread.getName();
        System.out.println("name = " + name);
        assert name.equals("base-1");
View Full Code Here

        System.out.println("name = " + name);
        assert name.equals("base-2");
    }

    public void testPatterns() {
        factory=new DefaultThreadFactory(null, BASE, true, false);
        factory.setAddress(ADDR);
        Thread thread=factory.newThread(new MyRunnable(), BASE);
        String name=thread.getName();
        System.out.println("name = " + name);
        assert name.equals(BASE);
View Full Code Here


    @BeforeMethod
    protected void setUp() throws Exception {
        ct1=new TCPConnectionMap("TCPConnectionMap1",
                                 new DefaultThreadFactory(Util.getGlobalThreadGroup(), "test", true),
                                 null, null, null, null, port1, port1);

        ct1.setUseSendQueues(false);
        ct1.start();
        ct2=new TCPConnectionMap("TCPConnectionMap2",
                                 new DefaultThreadFactory(Util.getGlobalThreadGroup(), "test", true),
                                 null, null, null, null, port2, port2);
        ct2.setUseSendQueues(false);
        ct2.start();
    }
View Full Code Here

    static AtomicInteger conn_creations=new AtomicInteger(0);

    final static long   MAX_JOIN_TIMEOUT=Global.THREAD_SHUTDOWN_WAIT_TIME;

    protected BasicConnectionTable() {       
        factory = new DefaultThreadFactory(new ThreadGroup(Util.getGlobalThreadGroup(),"ConnectionTable"),"Connection Table", false);
    }
View Full Code Here

   private void fixProtocolThreadFactories(TP tp, ThreadDecoratorImpl threadDecorator)
   {
      ThreadFactory stackFactory = tp.getThreadFactory();
      if (stackFactory == null)
      {
         stackFactory = new DefaultThreadFactory(Util.getGlobalThreadGroup(), "", false);
         tp.setThreadFactory(stackFactory);
      }
      fixThreadManager(stackFactory, threadDecorator, "TP.getThreadFactory()");
     
      log.debug("Fixed thread factory for " + tp);
     
      ThreadFactory timerFactory = tp.getTimerThreadFactory();
      if (timerFactory == null)
      {
         timerFactory = new LazyThreadFactory(Util.getGlobalThreadGroup(), "Timer", true, true);
         tp.setTimerThreadFactory(timerFactory);           
      }
      fixThreadManager(timerFactory, threadDecorator, "TP.getTimerThreadFactory()");
     
      log.debug("Fixed timer thread factory for " + tp);
     
      ThreadGroup pool_thread_group = null;
      if (tp.isDefaulThreadPoolEnabled())
      {
         ThreadFactory defaultPoolFactory = tp.getDefaultThreadPoolThreadFactory();
         if (defaultPoolFactory == null)
         {
            pool_thread_group=new ThreadGroup(Util.getGlobalThreadGroup(), "Thread Pools");
            defaultPoolFactory = new DefaultThreadFactory(pool_thread_group, "Incoming", false, true);
            tp.setThreadFactory(defaultPoolFactory);
         }
         fixThreadManager(defaultPoolFactory, threadDecorator, "TP.getDefaultThreadPoolThreadFactory()");
        
         log.debug("Fixed default pool thread factory for " + tp);
      }
     
      if (tp.isOOBThreadPoolEnabled())
      {
         ThreadFactory oobPoolFactory = tp.getOOBThreadPoolThreadFactory();
         if (oobPoolFactory == null)
         {
            if (pool_thread_group == null)
               pool_thread_group=new ThreadGroup(Util.getGlobalThreadGroup(), "Thread Pools");
            oobPoolFactory = new DefaultThreadFactory(pool_thread_group, "OOB", false, true);
            tp.setThreadFactory(oobPoolFactory);
         }
         fixThreadManager(oobPoolFactory, threadDecorator, "TP.getOOBThreadPoolThreadFactory()");
        
         log.debug("Fixed oob pool thread factory for " + tp);
View Full Code Here

    static AtomicInteger conn_creations=new AtomicInteger(0);

    final static long   MAX_JOIN_TIMEOUT=Global.THREAD_SHUTDOWN_WAIT_TIME;

    protected BasicConnectionTable() {
        factory = new DefaultThreadFactory(new ThreadGroup(Util.getGlobalThreadGroup(),"ConnectionTable"),"Connection Table", false);
    }
View Full Code Here

TOP

Related Classes of org.jgroups.util.DefaultThreadFactory

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.