java - Multi-Thread BufferedReader for reading .txt -


i'm wanting read line of .txt task, , move on next line.

to make program quicker, want multi-thread each thread tries line.

the problem is, don't want thread 1 trying same line thread 2.

any ideas?

i suggest have one thread doing reading, put lines producer/consumer queue (e.g. linkedblockingqueue) - can have multiple threads servicing queue consumers.

you don't want multiple threads performing io here - if had multiple independent bufferedreaders, if you're reading traditional disks don't want end seeking in multiple places. producer/consumer queue separates reading handling - , makes easier test each part in isolation well.


Comments

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -