@Test(expected=IllegalStateException.class) public void testGetThreadWithIndexFromEmptyPool() { for (int i=0; i<numThreads; i++) { ThreadsEngine.getThreadWithIndex(i); } }
public static ExecutorService getThreadWithIndex(int index) { if (threadPool.size() <= 0 ) throw new IllegalStateException("Try to get ExecutorService from an empty pool."); index %= threadPool.size(); return threadPool.get(index); }
ThreadsEngine { public static ExecutorService getThreadWithIndex(int index) { if (threadPool.size() <= 0 ) throw new IllegalStateException("Try to get ExecutorService from an empty pool."); index %= threadPool.size(); return threadPool.get(index); } }
ThreadsEngine { public static ExecutorService getThreadWithIndex(int index) { if (threadPool.size() <= 0 ) throw new IllegalStateException("Try to get ExecutorService from an empty pool."); index %= threadPool.size(); return threadPool.get(index); }  }
ThreadsEngine { public static ExecutorService getThreadWithIndex(int index) { if (threadPool.size() <= 0 ) throw new IllegalStateException("Try to get ExecutorService from an empty pool."); index %= threadPool.size(); return threadPool.get(index); }  static void setNumberOfThreads(int numThreads); static int getNumberOfThreads(); static ExecutorService getThreadWithIndex(int index); static void submitTopology(Topology topology, int numThreads); static void clearThreadPool(); }
ThreadsEngine { public static ExecutorService getThreadWithIndex(int index) { if (threadPool.size() <= 0 ) throw new IllegalStateException("Try to get ExecutorService from an empty pool."); index %= threadPool.size(); return threadPool.get(index); }  static void setNumberOfThreads(int numThreads); static int getNumberOfThreads(); static ExecutorService getThreadWithIndex(int index); static void submitTopology(Topology topology, int numThreads); static void clearThreadPool();  }