Examples of DefaultThreadFactory


Examples of org.infinispan.factories.threads.DefaultThreadFactory

            assertEquals("tcp", g.transport().properties().getProperty("stack-tcp"));
            assertEquals("jgroups-udp.xml", g.transport().properties().getProperty("stackFilePath-udp"));
            assertEquals("jgroups-tcp.xml", g.transport().properties().getProperty("stackFilePath-tcp"));
            assertEquals("tcp", g.transport().properties().getProperty("stack"));

            DefaultThreadFactory threadFactory =
                  cm.getCacheManagerConfiguration().listenerThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());

            assertTrue(cm.getCacheManagerConfiguration().transport().totalOrderThreadPool().threadPoolFactory() instanceof CachedThreadPoolExecutorFactory);
            threadFactory = cm.getCacheManagerConfiguration().transport().totalOrderThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());

            assertTrue(cm.getCacheManagerConfiguration().evictionThreadPool().threadPoolFactory() instanceof ScheduledThreadPoolExecutorFactory);
            threadFactory = cm.getCacheManagerConfiguration().evictionThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());

            assertTrue(cm.getCacheManagerConfiguration().replicationQueueThreadPool().threadPoolFactory() instanceof ScheduledThreadPoolExecutorFactory);
            threadFactory = cm.getCacheManagerConfiguration().replicationQueueThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());

            assertTrue(cm.getCacheManagerConfiguration().replicationQueueThreadPool().threadPoolFactory() instanceof ScheduledThreadPoolExecutorFactory);
            threadFactory = cm.getCacheManagerConfiguration().replicationQueueThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());

            threadFactory = cm.getCacheManagerConfiguration().transport().transportThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());
            BlockingThreadPoolExecutorFactory threadPool = cm.getCacheManagerConfiguration().transport().transportThreadPool().threadPoolFactory();
            assertEquals(6, threadPool.coreThreads()); // overriden by TestCacheManagerFactory
            assertEquals(6, threadPool.maxThreads()); // overriden by TestCacheManagerFactory
            assertEquals(10000, threadPool.queueLength()); // overriden by TestCacheManagerFactory
            assertEquals(30000, threadPool.keepAlive())// overriden by TestCacheManagerFactory

            threadFactory = cm.getCacheManagerConfiguration().listenerThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());
            threadPool = cm.getCacheManagerConfiguration().listenerThreadPool().threadPoolFactory();
            assertEquals(1, threadPool.coreThreads());
            assertEquals(1, threadPool.maxThreads());
            assertEquals(0, threadPool.queueLength());
            assertEquals(0, threadPool.keepAlive());
View Full Code Here

Examples of org.infinispan.factories.threads.DefaultThreadFactory

               throw ParseUtils.unexpectedAttribute(reader, i);
            }
         }
      }

      DefaultThreadFactory threadFactory = new DefaultThreadFactory(
            threadGroup, priority, threadNamePattern, null, null);
      threadFactories.put(name, threadFactory);
      ParseUtils.requireNoContent(reader);
   }
View Full Code Here

Examples of org.infinispan.factories.threads.DefaultThreadFactory

      ThreadPoolConfigurationBuilder threadPool = threadPools.get(threadPoolName);
      if (threadPool == null)
         throw log.undefinedThreadPoolName(threadPoolName);

      ThreadPoolConfiguration threadPoolConfiguration = threadPool.create();
      DefaultThreadFactory threadFactory = threadPoolConfiguration.threadFactory();
      threadFactory.setComponent(shortened(componentName));
      return threadPoolConfiguration;
   }
View Full Code Here

Examples of org.infinispan.factories.threads.DefaultThreadFactory

            assertEquals("tcp", g.transport().properties().getProperty("stack-tcp"));
            assertEquals("jgroups-udp.xml", g.transport().properties().getProperty("stackFilePath-udp"));
            assertEquals("jgroups-tcp.xml", g.transport().properties().getProperty("stackFilePath-tcp"));
            assertEquals("tcp", g.transport().properties().getProperty("stack"));

            DefaultThreadFactory threadFactory =
                  cm.getCacheManagerConfiguration().listenerThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());

            assertTrue(cm.getCacheManagerConfiguration().transport().totalOrderThreadPool().threadPoolFactory() instanceof CachedThreadPoolExecutorFactory);
            threadFactory = cm.getCacheManagerConfiguration().transport().totalOrderThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());

            assertTrue(cm.getCacheManagerConfiguration().evictionThreadPool().threadPoolFactory() instanceof ScheduledThreadPoolExecutorFactory);
            threadFactory = cm.getCacheManagerConfiguration().evictionThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());

            assertTrue(cm.getCacheManagerConfiguration().replicationQueueThreadPool().threadPoolFactory() instanceof ScheduledThreadPoolExecutorFactory);
            threadFactory = cm.getCacheManagerConfiguration().replicationQueueThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());

            assertTrue(cm.getCacheManagerConfiguration().replicationQueueThreadPool().threadPoolFactory() instanceof ScheduledThreadPoolExecutorFactory);
            threadFactory = cm.getCacheManagerConfiguration().replicationQueueThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());

            threadFactory = cm.getCacheManagerConfiguration().transport().transportThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());
            BlockingThreadPoolExecutorFactory threadPool = cm.getCacheManagerConfiguration().transport().transportThreadPool().threadPoolFactory();
            assertEquals(6, threadPool.coreThreads()); // overriden by TestCacheManagerFactory
            assertEquals(6, threadPool.maxThreads()); // overriden by TestCacheManagerFactory
            assertEquals(10000, threadPool.queueLength()); // overriden by TestCacheManagerFactory
            assertEquals(30000, threadPool.keepAlive())// overriden by TestCacheManagerFactory

            threadFactory = cm.getCacheManagerConfiguration().listenerThreadPool().threadFactory();
            assertEquals("infinispan", threadFactory.threadGroup().getName());
            assertEquals("%G %i", threadFactory.threadNamePattern());
            assertEquals(5, threadFactory.initialPriority());
            threadPool = cm.getCacheManagerConfiguration().listenerThreadPool().threadPoolFactory();
            assertEquals(1, threadPool.coreThreads());
            assertEquals(1, threadPool.maxThreads());
            assertEquals(0, threadPool.queueLength());
            assertEquals(0, threadPool.keepAlive());
View Full Code Here

Examples of org.infinispan.factories.threads.DefaultThreadFactory

      BlockingThreadPoolExecutorFactory listenerThreadPool =
            cm.getCacheManagerConfiguration().listenerThreadPool().threadPoolFactory();
      assertEquals(5, listenerThreadPool.maxThreads());
      assertEquals(10000, listenerThreadPool.queueLength());
      DefaultThreadFactory listenerThreadFactory =
            cm.getCacheManagerConfiguration().listenerThreadPool().threadFactory();
      assertEquals("AsyncListenerThread", listenerThreadFactory.threadNamePattern());

      BlockingThreadPoolExecutorFactory persistenceThreadPool =
            cm.getCacheManagerConfiguration().persistenceThreadPool().threadPoolFactory();
      assertEquals(6, persistenceThreadPool.maxThreads());
      assertEquals(10001, persistenceThreadPool.queueLength());
      DefaultThreadFactory persistenceThreadFactory =
            cm.getCacheManagerConfiguration().persistenceThreadPool().threadFactory();
      assertEquals("PersistenceThread", persistenceThreadFactory.threadNamePattern());

      BlockingThreadPoolExecutorFactory transportThreadPool =
            cm.getCacheManagerConfiguration().transport().transportThreadPool().threadPoolFactory();
      assertEquals(TestCacheManagerFactory.MAX_ASYNC_EXEC_THREADS, transportThreadPool.maxThreads());
      assertEquals(TestCacheManagerFactory.ASYNC_EXEC_QUEUE_SIZE, transportThreadPool.queueLength());

      BlockingThreadPoolExecutorFactory remoteCommandThreadPool =
            cm.getCacheManagerConfiguration().transport().remoteCommandThreadPool().threadPoolFactory();
      assertEquals(TestCacheManagerFactory.MAX_REQ_EXEC_THREADS, remoteCommandThreadPool.maxThreads());
      assertEquals(TestCacheManagerFactory.KEEP_ALIVE, remoteCommandThreadPool.keepAlive());

      BlockingThreadPoolExecutorFactory totalOrderThreadPool =
            cm.getCacheManagerConfiguration().transport().totalOrderThreadPool().threadPoolFactory();
      assertEquals(16, totalOrderThreadPool.maxThreads());
      assertEquals(1, totalOrderThreadPool.coreThreads());
      assertEquals(1000, totalOrderThreadPool.keepAlive());
      assertEquals(0, totalOrderThreadPool.queueLength());
      DefaultThreadFactory totalOrderThreadFactory =
            cm.getCacheManagerConfiguration().transport().totalOrderThreadPool().threadFactory();
      assertEquals("TotalOrderValidatorThread", totalOrderThreadFactory.threadNamePattern());

      DefaultThreadFactory evictionThreadFactory =
            cm.getCacheManagerConfiguration().evictionThreadPool().threadFactory();
      assertEquals("EvictionThread", evictionThreadFactory.threadNamePattern());

      DefaultThreadFactory replicationQueueThreadFactory =
            cm.getCacheManagerConfiguration().replicationQueueThreadPool().threadFactory();
      assertEquals("ReplicationQueueThread", replicationQueueThreadFactory.threadNamePattern());

      assertTrue(gc.transport().transport() instanceof JGroupsTransport);
      assertEquals("infinispan-cluster", gc.transport().clusterName());
      // Should be "Jalapeno" but it's overriden by the test cache manager factory
      assertTrue(gc.transport().nodeName().contains("Node"));
View Full Code Here

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

Examples of org.jgroups.util.DefaultThreadFactory

    }


    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

Examples of org.jgroups.util.DefaultThreadFactory

        _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

Examples of org.jgroups.util.DefaultThreadFactory

    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

Examples of org.jgroups.util.DefaultThreadFactory

        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
TOP
Copyright © 2018 www.massapi.com. 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.