Java NiO — source code analysis of selector mechanism — conversion
•
Java
I haven't understood how pipe wakes up the selector, so I went to see the source code of JDK (openjdk download), and sorted it out as follows:
Take Java NiO as its own Demo: operationserver java OperationClient. Java (see attachment)
The core code of the server side:
From the beginning,
First look at selectorprovider What does provider () do:
Where provider = sun nio. ch.DefaultSelectorProvider. create(); Different implementation classes will be returned according to the operating system, and the windows platform will return windowsselectorprovider;
And @ h_ 419_ 71@if (provider != @H_419_ 71@null )
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码