JBJCA 1177

 This PR introduces a performance optimization for the returnConnection method. It moves work outside of a lock to minimize the time the lock is held.