<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
I don't know anything about DBCP2 but I'm curious to know if you really <br>
need to use a Semaphore with DataSource.getConnection. If it doing JDBC <br>
connection pooling then I would expect it would block, waiting for <br>
someone else to close a Connection and return it to the pool.<br><br></blockquote><div><br></div><div>You don't need it. For the semaphore case I'm not using a connection pool. The reason I added it, because it is very simple, and I can reason about its expected behaviour easier. Of course, in that case I'm not saving the creation of a new connection, but I can still test thread pinning.</div></div></div>