Java proxool source code analysis

Source: Internet
Author: User

Entry Point: proxoolfacade.

 

Startup sequence:

Proxooldriver-> proxoolfacade. registerconnectionpool->

 

Call Sequence

Proxooldriver. Connect-> connectionpoolmanager. getconnectionpool-> connectionpool. getconnection

-> Proxyconnection = prototyper. buildconnection-> proxyconnection. open ();

-> Proxyfactory. getwrappedconnection (proxyconnection)

-> Wrappedconnection

 

The proxy mode is used for subsequent calls.

 

Close link:

Wrappedconnection-> close-> proxyconnection. Close ()

-> Openstatements. Close-> connectionpool. removeproxy

 

Actually close the link:

Housekeeper-> connectionpool. removeproxyconnection-> compositeconnectionlistener. ondeath->

Connectionlistenerif. ondeath

Proxyconnection. reallyclose ();

Proxyconnections. Remove (proxyconnection );

 

----------------------------------

Connection Pool Design Principles:

1. When no request is sent, the connection pool is 0.

2. When there is a stable request, the connection can be reused to improve the performance.

3. When the connection pool suddenly breaks out, the connection pool capability is increased.

4. automatically reduces the connection pool capacity after peak hours.

 

5. After the connection starts the transaction, the link is exclusive and cannot be allocated.

Http://www.zhujiangroad.com/html/soft/s2928.html

Research and Design of JDBC-based database connection pool technology

. Connect to add a reference counter

. When a user accesses closeconnection, How many times does it determine the number of references? Yes, it will be deleted; judge whether to set the minimum number of connections? If it is smaller than the value, it will be put back; otherwise, it will be deleted.

. Each transaction exclusive a connection

 

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.