Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EDA6AC2ED for ; Fri, 18 May 2012 19:18:31 +0000 (UTC) Received: (qmail 2554 invoked by uid 500); 18 May 2012 19:18:31 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 2494 invoked by uid 500); 18 May 2012 19:18:31 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 2483 invoked by uid 99); 18 May 2012 19:18:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 May 2012 19:18:31 +0000 X-ASF-Spam-Status: No, hits=-1997.8 required=5.0 tests=ALL_TRUSTED,HTML_MESSAGE X-Spam-Check-By: apache.org Received: from [140.211.11.115] (HELO eir.zones.apache.org) (140.211.11.115) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 May 2012 19:18:28 +0000 Received: by eir.zones.apache.org (Postfix, from userid 80) id 2E6F95A88; Fri, 18 May 2012 19:18:07 +0000 (UTC) From: bugzilla@apache.org To: dev@tomcat.apache.org Subject: [Bug 53254] Support for purging connection pool Date: Fri, 18 May 2012 19:18:05 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Tomcat Modules X-Bugzilla-Component: jdbc-pool X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: youngm@gmail.com X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@tomcat.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: multipart/alternative; boundary="1337368687.AD8F1.95544"; charset="us-ascii" X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 --1337368687.AD8F1.95544 Date: Fri, 18 May 2012 19:18:07 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://issues.apache.org/bugzilla/show_bug.cgi?id=53254 --- Comment #2 from Mike Youngstrom --- Nice! Thanks Filip! For laughs here is the workaround implementation I created yesterday. :) public void purge() throws Exception { long oldMaxAge = dataSource.getMaxAge(); int oldMaxIdle = dataSource.getMaxIdle(); int oldMaxActive = dataSource.getMaxActive(); int oldMinEvictTime = dataSource.getMinEvictableIdleTimeMillis(); PooledConnection connection = dataSource.getPooledConnection(); IllegalStateException error = null; try { dataSource.setMaxActive(1); dataSource.setMaxIdle(1); dataSource.setMaxAge(1); dataSource.setMinEvictableIdleTimeMillis(1); int sec = 0; Thread.sleep(1001); while(dataSource.getActive() > 1 && sec < 29) { Thread.sleep(1000); sec++; } dataSource.checkIdle(); if(dataSource.getActive() > 1) { error = new IllegalStateException("Closed all but "+(dataSource.getActive()-1)+" connection(s) after 30 sec. Try again."); } connection.close(); } finally { dataSource.setMaxAge(oldMaxAge); dataSource.setMaxActive(oldMaxActive); dataSource.setMaxIdle(oldMaxIdle); dataSource.setMinEvictableIdleTimeMillis(oldMinEvictTime); if(error != null) { throw error; } } } -- You are receiving this mail because: You are the assignee for the bug. --1337368687.AD8F1.95544--