I want to pull multiple files from a queue and parse them simultaneously. However, my executor is only calling one thread:
private static ScheduledExecutorService parsingExec ;
protected static BlockingQueue<Path> queue = new LinkedBlockingQueue<>();
int threadPoolSize = 10;
parsingExec = Executors.newScheduledThreadPool(threadPoolSize);
parsingExec.scheduleAtFixedRate(new MyParser(queue), 0, 0, TimeUnit.MILLISECONDS);
From the Javadoc for
scheduleWithFixedRate():This method is for scheduling a single task, to be executed multiple times. The key thing to note being that only one instance of your task will ever be executing at a time. If you want to execute multiple tasks simultaneously then you should be using, for example, a fixed thread pool instead.