Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • Your while (!dataQueue.isEmpty()) loop is running constantly, which is using a great deal of CPU and is very inefficient. Use a LinkedBlockingQueue instead of a ConcurrentLinkedQueue, so you can do while (true) { String line = dataQueue.take(); … }, which will not execute any code unless and until the queue has an element available. Commented Feb 17, 2020 at 15:34
  • 1
    How big is the file? Will there be tens of words? hundreds? Thousands? Tens of thousands? Concurrency will only start to prove itself when you process a large amount of data which takes a long time to process. Commented Feb 17, 2020 at 15:36
  • stackoverflow.com/q/24688645/1835769 Commented Feb 17, 2020 at 15:47