this question deserve a detailed answer. hmmmmm
- the connection pool always have some no of connections, always. as you mentioned it 10. you can say it as initial size.
- if all connection are in use by a no of requests, then there is a mechanism which will increase the pool with an extent, say 5. it means if all connection objects are busy the pool definitely increase but by 5 because if it increase just by 1 then there would be a definite chance to make another connection soon. thus it will make 5 connections when increase. and so on.
- but again there would be a maxsize defined, say 30 then if the pool size is already 30 then the new request must wait for sometime.
- after getting some no of connections back it will destroy some connection objects which were made on need basis. say there is 10 objects in the pool all gets busy. on new request the pool increases by 5. now there is 15 no of connections. say 12 is in use and 3 are there for coming requests. but no request are made and 8 connections are back. then it will destroy 5 connections which were made on need basis and still have 6 there in the pool. and if the remaining connection would come be back then it would gain all 10 connections which was the starting no.
- yes, pool should takecare about the stale connections. it can handle it by some mechanism.
i tried my best to give you the idea. please appreciate
cheers.