Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static List<Item> parse() {
- CountDownLatch latch = new CountDownLatch(1000);
- for (int i = 1; i <= 1000; i++) {
- Executor executor = Executors.newFixedThreadPool(20);
- Parser thread = new Parser(latch);
- thread.setName(Integer.toString(i));
- threadCount++; //increase the number of working threads
- executor.submit(thread);
- }
- latch.await();
- return itemList;
- }
- public void run() {
- // jsut add the line after you code
- latch.countDown();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement