Connection Pool

From: Jonathan Tripathy <jonnyt(at)abpni(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Connection Pool
Date: 2010-11-01 17:42:28
Message-ID: 4CCEFC04.2090803@abpni.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Everyone,

I'm trying to work with connection pools. The example I'm looking at is
lockated here:

http://www.developer.com/img/2009/11/Listing1_ConnectionPoolClass.html

You will notice that the getConnectionFromPool method does not implement
any blocking, and only returns null.

I would like my application to try and get a connection from the pool,
and if there are none free, wait until either one is free or time is up.

What is the best way to do this? Would creating a wrapper method work?
This wrapper method would check for null, and if so, execute a while
loop until a connection is returned. Also, would this wrapper method
need to be synchronised (remembering that multiple threads may be trying
to get a connection)?

Thanks

Jonny

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Carlos Mennens 2010-11-01 17:49:08 Re: 8.4 Data Not Compatible with 9.0.1 Upgrade?
Previous Message Jonathan Tripathy 2010-11-01 17:37:54 JDBC Transactions