https://bz.apache.org/bugzilla/show_bug.cgi?id=64809

--- Comment #2 from xiongchao <xiongchao90.1...@163.com> ---
 protected void returnConnection(PooledConnection con) {
        if (this.isClosed()) {
            this.release(con);
        } else {
            if (con != null) {
                try {
                    this.returnedCount.incrementAndGet();
                    con.lock();
                    if (con.isSuspect()) {
                        if (this.poolProperties.isLogAbandoned() &&
log.isInfoEnabled()) {
                            log.info("Connection(" + con + ") that has been
marked suspect was returned." + " The processing time is " +
(System.currentTimeMillis() - con.getTimestamp()) + " ms.");
                        }

                        if (this.jmxPool != null) {
                            this.jmxPool.notify("SUSPECT CONNECTION RETURNED",
"Connection(" + con + ") that has been marked suspect was returned.");
                        }
                    }

                    if (this.busy.remove(con)) {
                        if (!this.shouldClose(con, 2)) {
                            con.setStackTrace((String)null);
                            con.setTimestamp(System.currentTimeMillis());
                            if (this.idle.size() >=
this.poolProperties.getMaxIdle() && !this.poolProperties.isPoolSweeperEnabled()
|| !this.idle.offer(con)) {
                                if (log.isDebugEnabled()) {
                                    log.debug("Connection [" + con + "] will be
closed and not returned to the pool, idle[" + this.idle.size() + "]>=maxIdle["
+ this.poolProperties.getMaxIdle() + "] idle.offer failed.");
                                }

                                this.release(con);
                            }
                        } else {
                            if (log.isDebugEnabled()) {
                                log.debug("Connection [" + con + "] will be
closed and not returned to the pool.");
                            }

                            this.release(con);
                        }
                    } else {
                        if (log.isDebugEnabled()) {
                            log.debug("Connection [" + con + "] will be closed
and not returned to the pool, busy.remove failed.");
                        }

                        this.release(con);
                    }
                } finally {
                    con.unlock();
                }
            }

        }
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to