Reputation: 6145
I've looked all over but I could not find a good example explaining NIO2 or how to do asynchronous IO with Java sockets. For example, if I want to speed up a web crawler by allowing threads to use async IO to read from sockets instead of regular synchronous IO, how would I achieve this?
Upvotes: 0
Views: 924
Reputation: 13535
NIO2 is not faster than synchronous I/O. It allows to run many connections (tens of thousands) with a few threads. If you can afford to spend a thread for each connection, use synchronous I/O - it is simpler to program.
Upvotes: 1