This is probably about the best forum to ask in, even though what you're actually asking about is the Apache dbcp component. But it's bundled with Tomcat.
For all intents and purposes, Connections in a dbcp object are stored in a Collection object. If you want the whole sordid story, it builds on several Apache commons components, including the extended Apache collections and the apache resource pooler. But you can simply think of it as a java.util.List if you want to.
When you request a Connection, the next Connection on the list is returned. If the list is emply, dbcp will check its configuration and construct additional connections up to the configured limit.
When you close a Connection, the dbcp connection wrapper's close() method returns the Connection to the list for someone else to use.
When the database server is re-cycled OR if the connection times out, dbcp doesn't know or care. In fact, any connections checked out of the pool and in use will exhibit the same behavior as if you'd done a non-pooled connection and the backend dropped out.
The connection timeout issue is actually a more common problem. There are some configuration options on dbcp to allow it to validate a connection before releasing it from the pool. Typically, this is a simple test query such as "SELECT 1 FROM DUAL". If the test fails, the connection is discarded and a new one is used, instead.
Blitzlügen - Lies or information broadcast, but when called out the broadcaster does little or nothing is done to correct them, thus allowing those who wish to believe to accept them as truth.
Lügensturm - A barrage of Blitzlügen fired in such quick succession that it is essentially impossible to correct them all.
If you want to look young and thin, hang around old, fat people. Or this tiny ad: