• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

implementing connection pool

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Experts,

I am trying to implement connection pooling using ConnectionPoolDatasource in a simple java application. I am following these steps -

1) Create a PoolManager class with method to getConnection(). This class implements ConnectionEventListener
2) Create instance of ConnectionPoolDataSource (actually the implementation class provided by vendor)
3) Use getPooledConnection() calls on connectionpooldatasource to get ready with 10 pooled connections in a List
4) register PoolManager as connectionEventlistener to all these pooled connections
5) on Call to PoolManager.getConnection(), take one readymade pooledConnection from list and call getConnection() to obtain connection handle and return
6) In listener method for connectionClosed() get the event source (which is the corresonding PooledConnection) and add it back to list of available pooled connection

This seems to work. But I am not sure whether this is the right way to implement.
Please guide me on this.

Thanks
Pushker Chaubey
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pushker,
Very few people have implemented a connection pool. You might try seeing if dbcp does what you need. Or at least compare your algorithm.
 
reply
    Bookmark Topic Watch Topic
  • New Topic