@Test public void testCreateJDBCClientThreadPool() throws InterruptedException { String reason = "CreateJDBCClientThreadPool"; TThreadPoolServer.Args args = new Args(null); args.maxWorkerThreads = 100; args.minWorkerThreads = 10; args.stopTimeoutVal = 10; args.stopTimeoutUnit = TimeUnit.SECONDS; Thread.UncaughtExceptionHandler handler = new TestExceptionHandler(reason); int threadCount = 50; latch = new CountDownLatch(threadCount); ExecutorService exec = IoTDBThreadPoolFactory .createJDBCClientThreadPool(args, POOL_NAME, handler); for (int i = 0; i < threadCount; i++) { Runnable task = new TestThread(reason); exec.execute(task); } try { latch.await(); assertEquals(count.get(), threadCount); } catch (InterruptedException E) { fail(); } }
public static ExecutorService createJDBCClientThreadPool(Args args, String poolName) { SynchronousQueue<Runnable> executorQueue = new SynchronousQueue<Runnable>(); return new ThreadPoolExecutor(args.minWorkerThreads, args.maxWorkerThreads, args.stopTimeoutVal, args.stopTimeoutUnit, executorQueue, new IoTThreadFactory(poolName)); }
IoTDBThreadPoolFactory { public static ExecutorService createJDBCClientThreadPool(Args args, String poolName) { SynchronousQueue<Runnable> executorQueue = new SynchronousQueue<Runnable>(); return new ThreadPoolExecutor(args.minWorkerThreads, args.maxWorkerThreads, args.stopTimeoutVal, args.stopTimeoutUnit, executorQueue, new IoTThreadFactory(poolName)); } }
IoTDBThreadPoolFactory { public static ExecutorService createJDBCClientThreadPool(Args args, String poolName) { SynchronousQueue<Runnable> executorQueue = new SynchronousQueue<Runnable>(); return new ThreadPoolExecutor(args.minWorkerThreads, args.maxWorkerThreads, args.stopTimeoutVal, args.stopTimeoutUnit, executorQueue, new IoTThreadFactory(poolName)); }  }
IoTDBThreadPoolFactory { public static ExecutorService createJDBCClientThreadPool(Args args, String poolName) { SynchronousQueue<Runnable> executorQueue = new SynchronousQueue<Runnable>(); return new ThreadPoolExecutor(args.minWorkerThreads, args.maxWorkerThreads, args.stopTimeoutVal, args.stopTimeoutUnit, executorQueue, new IoTThreadFactory(poolName)); }  static ExecutorService newFixedThreadPool(int nthreads, String poolName); static ExecutorService newFixedThreadPool(int nthreads, String poolName,
      Thread.UncaughtExceptionHandler handler); static ExecutorService newSingleThreadExecutor(String poolName); static ExecutorService newSingleThreadExecutor(String poolName,
      Thread.UncaughtExceptionHandler handler); static ExecutorService newCachedThreadPool(String poolName); static ExecutorService newCachedThreadPool(String poolName,
      Thread.UncaughtExceptionHandler handler); static ScheduledExecutorService newSingleThreadScheduledExecutor(String poolName); static ScheduledExecutorService newSingleThreadScheduledExecutor(String poolName,
      Thread.UncaughtExceptionHandler handler); static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, String poolName); static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, String poolName,
      Thread.UncaughtExceptionHandler handler); static ExecutorService createJDBCClientThreadPool(Args args, String poolName); static ExecutorService createJDBCClientThreadPool(Args args, String poolName,
      Thread.UncaughtExceptionHandler handler); }
IoTDBThreadPoolFactory { public static ExecutorService createJDBCClientThreadPool(Args args, String poolName) { SynchronousQueue<Runnable> executorQueue = new SynchronousQueue<Runnable>(); return new ThreadPoolExecutor(args.minWorkerThreads, args.maxWorkerThreads, args.stopTimeoutVal, args.stopTimeoutUnit, executorQueue, new IoTThreadFactory(poolName)); }  static ExecutorService newFixedThreadPool(int nthreads, String poolName); static ExecutorService newFixedThreadPool(int nthreads, String poolName,
      Thread.UncaughtExceptionHandler handler); static ExecutorService newSingleThreadExecutor(String poolName); static ExecutorService newSingleThreadExecutor(String poolName,
      Thread.UncaughtExceptionHandler handler); static ExecutorService newCachedThreadPool(String poolName); static ExecutorService newCachedThreadPool(String poolName,
      Thread.UncaughtExceptionHandler handler); static ScheduledExecutorService newSingleThreadScheduledExecutor(String poolName); static ScheduledExecutorService newSingleThreadScheduledExecutor(String poolName,
      Thread.UncaughtExceptionHandler handler); static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, String poolName); static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, String poolName,
      Thread.UncaughtExceptionHandler handler); static ExecutorService createJDBCClientThreadPool(Args args, String poolName); static ExecutorService createJDBCClientThreadPool(Args args, String poolName,
      Thread.UncaughtExceptionHandler handler);  }