Click here to Skip to main content
15,923,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to create shrink() connection method in java servlet?
feature to shrink the pool size when the connections are not needed are important to improve the performance of application
Posted
Comments
TorstenH. 14-Nov-11 9:31am    
you have a pool of connections - how do you check if they are valid any more? How often do you check? is there a certain point in time when you can tell if the connection is due to be disposed?
nazila24 16-Nov-11 20:41pm    
no, i don't set any idle time,because i don't have an idea how to set it..could you please help me. thank you

1 solution

Keep a tab on how many objects are being used on average and when one is released discard it if you have too many.
I have implemented dynamic pooling in the past and it is easy to find yourself creating and discarding more than you need to. In practice it is sensible to keep track of the trend, that is what is more common currently - request or returns.
If you are receiving more requests then returns, don't discard instances as they'll probably be needed.
 
Share this answer
 
Comments
nazila24 16-Nov-11 20:36pm    
ok thanks...can you give me an example.because i don't have any idea to start doing coding about it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900