@Override
    public void returnConnection(PoolableConnection connection) {
        requireNonNull(connection);
        leaseReturn(connection);
        if (!isValidOrNull(connection)) {
            discard(connection);
        } else {
            final String key = makeKey(connection);
            final Deque<PoolableConnection> q = acquireDeque(key);
            if (q.size() >= getMaxRetainSize()) {
                discard(connection);
            } else {
                LOGGER_CONNECTION.debug("Recycled: %s", connection);
                q.addFirst(connection);
            }
        }
    }
A fully concurrent implementation of a connection pool.

@author Per Minborg
runtime-parent/runtime-core/src/main/java/com/speedment/runtime/core/internal/component/ConnectionPoolComponentImpl.java