I need to program an application that manages a pool of connection. I would like to know which algorithms should be studied.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A typical Pool implementation would have a free bucket stack:
This favors re-use of the last used connection, which is good for caching.
When giving a connection to the user, you’ll use RAII so that it’ll get back to the Pool automatically (and deterministically) when all references to it are dropped.
Now, it’s up to you to decide how to handle the events:
Those are implementation details of your pool and should be adapted depending on your requirements.