Asynchronous communication involves making a request, and then proceeding with some other operation without having to wait for the request to be completed. This is referred to as non-blocking.
There are three classes used to support asynchronous channel operations:
The read/write methods of the AsynchronousSocketChannel
class are asynchronous. The AsynchronousServerSocketChannel
class possesses an accept
method, which returns an AsynchronousSocketChannel
instance. This method is also asynchronous. We will discuss the AsynchronousDatagramChannel
class in Chapter 6, UDP and Multicasting.
There are two ways of handling asynchronous I/O operations:
Using the
Future
interface found in thejava.util.concurrent
packageUsing a
CompletionHandler...