Netty3 Source Analysis-Oioclientsocketchannelfactory

Source: Internet
Author: User


is a clientsocketchannelfactory implementation, based on the Socketchannel blocking mode of the client channel. The use of the traditional blocking IO API is characterized by good throughput and low latency, when the number of connections required for the service is small. (Contact the difference between NiO and OIO)
There is only one thread type in oioclientsocketchannelfactory, worker threads. Each connected channel has a dedicated worker, which is the traditional IO model . (see)
when Oioclientsocketchannelfactory is constructed, the parameter thread pool object, such as Executors.newcachedthreadpool (), is the source of the worker threads. So make sure that the specified executor can provide a sufficient number of threads. The worker thread is deferred (acquired lazily) and is freed when there is no transaction to process, and all Yu's thread-related resources are freed, so gracefully shut down the service (close all channel first, call Channelgroup.close (), and then call Releaseexternalresources () to release the external resource).
be careful not to shut down the executor before all the channels are closed, otherwise rejectedexecutionexception will occur, and some related resources will not be released normally. restriction : Socketchannel created by Oioclientsocketchannelfactory does not support asynchronous operations, and any IO operations, such as connections, writes, etc. are blocked by execution.












Netty3 Source Analysis-Oioclientsocketchannelfactory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.