Esempio n. 1
0
  public void testCustomThreadFactory() {
    ThreadingProfile profile = new ThreadingProfile();

    ThreadFactory configuredFactory =
        new ThreadFactory() {
          public Thread newThread(Runnable r) {
            return null;
          }
        };

    profile.setThreadFactory(configuredFactory);
    ThreadPoolExecutor pool = profile.createPool();
    ThreadFactory returnedFactory = pool.getThreadFactory();
    assertSame(configuredFactory, returnedFactory);
  }
Esempio n. 2
0
 public void testDefaultNamedThreadFactory() {
   ThreadingProfile profile = new ThreadingProfile();
   ThreadPoolExecutor pool = profile.createPool("myThreadPool");
   ThreadFactory returnedFactory = pool.getThreadFactory();
   assertTrue(returnedFactory instanceof NamedThreadFactory);
 }
Esempio n. 3
0
 public void testDefaultThreadFactory() {
   ThreadingProfile profile = new ThreadingProfile();
   ThreadPoolExecutor pool = profile.createPool();
   ThreadFactory returnedFactory = pool.getThreadFactory();
   assertTrue(returnedFactory.getClass().isInstance(Executors.defaultThreadFactory()));
 }