Chapter    13

Asynchronous I/O

NIO provides multiplexed I/O (a combination of nonblocking I/O, discussed in Chapter 7, and readiness selection, discussed in Chapter 8) to facilitate the creation of highly scalable servers. Client code registers a socket channel with a selector to be notified when the channel is ready to start I/O.

NIO.2 provides asynchronous I/O, which lets client code initiate an I/O operation and subsequently notifies the client when the operation is complete. Like multiplexed I/O, asynchronous I/O is also commonly used to facilitate the creation of highly scalable servers.

Note  Multiplexed I/O is often used with operating systems that offer highly scalable and performant polling interfaces—Linux and Solaris are examples. ...

Get Java I/O, NIO and NIO.2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.