While looking to upgrade to tomcat7, i understand the connection pool is a major improvement. I read that commons-dbcp is single threaded, in order to be thread safe commons-dbcp locks the entire pool, even during query validation.
Where did you read that? While it might have been true of earlier DBCP releases I'm fairly sure it is not true for current releases.
So as i understand, the connection pool will be locked when handing out new connections and other threads which need connections from the pool will wait until they are handed their respective connection?
There are brief periods of locking but they do no last the entire of the borrow() and the return() methods.
There is contention during borrow() and return() but you'll only notice it on multi-core systems the borrow() / return() at high rates.
Tomcat 7 ships with jdbc-pool that does not have this contention.
DBCP2 also does not have this contention and is used (in snapshot form as there has not yet been an official release) in Tomcat 8 onwards.
Is my understanding right
The best way to understand exactly what is locked and when is to look at the source.