On 4 February 2015 at 13:51, Phil Steitz <phil.ste...@gmail.com> wrote: > I had to go around getNumIdle to avoid waiting on a this lock in the > unit test I just committed. With pool 2 and volatile connectionPool > instance, I don't think this sync is needed any more. Same with the > sync on getNumActive. Am I missing something here?
I think there are two potential issues here. The first is that getNumIdle will fail with NPE if another thread closes the pool in the meantime. That can be handled by taking a copy of the reference first. The second possible issue is ensuring safe publication - I think volatile should be sufficient here. > Phil > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org