if (permits.tryAcquire(poolConfiguration.getBlockingTimeout(), TimeUnit.MILLISECONDS))
{
statistics.deltaTotalBlockingTime(System.currentTimeMillis() - startWait);
//We have a permit to get a connection. Is there one in the pool already?
ConnectionListener cl = null;
do
{
synchronized (cls)
{
if (shutdown.get())
{
permits.release();
throw new RetryableUnavailableException(
bundle.thePoolHasBeenShutdown(pool.getName(),
Integer.toHexString(System.identityHashCode(this))));
}
if (cls.size() > 0)
{
cl = cls.remove(0);
checkedOut.add(cl);
statistics.setInUsedCount(checkedOut.size());
}
}
if (cl != null)
{
//Yes, we retrieved a ManagedConnection from the pool. Does it match?
try
{
Object matchedMC = mcf.matchManagedConnections(Collections.singleton(cl.getManagedConnection()),
subject, cri);
if (matchedMC != null)
{
if (trace)