In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "what is the concept of java stream". In daily operation, I believe that many people have doubts about what the concept of java stream is. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "what is the concept of Java stream?" Next, please follow the editor to study!
IO/BIO
BIO refers to IO, that is, the traditional Blocking IO, that is, synchronized and blocked IO. This is also the only option before jdk1.4, depending on the ServerSocket implementation, that is, a request corresponds to a thread, and if there are not enough threads to connect, it will wait for the free thread or reject the connection. Therefore, in this way, the efficiency is very low and unreliable in the case of high concurrency, and it is generally only used in applications with a small number of connections and fixed architecture, but api is also relatively easy to use.
NIO
The new IO, that is, New IO or Non-Blocking IO, is the synchronous non-blocking IO. Jdk1.4 then provides a series of methods to manipulate the flow, which are defined under the java.nio package. Compared with the traditional BIO,NIO, which provides high-speed and fast-oriented Imax O, it adds the concepts of Buffer, Channel, Selector and so on. It is event-driven and adopts Reactor mode. It uses a thread to manage all socket channels, that is, connection requests sent by clients are registered on the multiplexer, and a thread is started to process when the multiplexer polls that there is an Icano request for the connection. Its characteristic is to constantly take the initiative to ask whether the data has been processed, and it is generally only suitable for applications with a large number of connections but short connection time, such as chat applications.
AIO
The new IO2.0, or NIO2.0,jdk1.7, is called asynchronous non-blocking IO. AIO introduces the concept of abnormal channel and adopts the Proactor mode, which simplifies the programming. A valid request starts a thread. Its characteristic is that the server program is notified to start the thread after the completion of the operating system. It is generally suitable for applications with a large number of connections and a long connection time.
Comprehensive comparison of several IO:
BIONIOAIO client: number of threads 1:1M:1M:0 blocking type blocking non-blocking synchronous type synchronous and asynchronous programming difficulty simple very complex debugging difficulty simple complex complex reliability very poor high throughput low high
The use of api for NIO provided by java is complex, and it is generally recommended to use a framework such as netty rather than the api that comes with jdk.
At this point, the study of "what is the concept of java stream" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.