Reapable ret = null;
long remainingTime = properties.getBorrowConnectionTimeout() * 1000L;
do {
ret = retrieveFirstAvailableConnectionAndGrowPoolIfNecessary(hmsg);
if ( ret == null ) {
EventPublisher.publish(new ConnectionPoolExhaustedEvent(properties.getUniqueResourceName()));
remainingTime = waitForAtLeastOneAvailableConnection(remainingTime);
assertNotDestroyed();
}
} while ( ret == null );
return ret;