Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 16700 invoked from network); 10 Jan 2010 12:02:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Jan 2010 12:02:18 -0000 Received: (qmail 2211 invoked by uid 500); 10 Jan 2010 12:02:17 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 2114 invoked by uid 500); 10 Jan 2010 12:02:17 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 2105 invoked by uid 99); 10 Jan 2010 12:02:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Jan 2010 12:02:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Jan 2010 12:02:15 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2C33123889E1; Sun, 10 Jan 2010 12:01:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r897623 - /commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Date: Sun, 10 Jan 2010 12:01:54 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100110120154.2C33123889E1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sebb Date: Sun Jan 10 12:01:53 2010 New Revision: 897623 URL: http://svn.apache.org/viewvc?rev=897623&view=rev Log: TEMP HACK: use nanoTime (Java 1.5+) to get better timer granularity Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=897623&r1=897622&r2=897623&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original) +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Sun Jan 10 12:01:53 2010 @@ -685,7 +685,7 @@ protected void multipleThreads(final int holdTime, final boolean expectError, long maxWait) throws Exception { - long startTime = System.currentTimeMillis(); + long startTime = timeStamp(); final PoolTest[] pts = new PoolTest[2 * getMaxActive()]; // Catch Exception so we can stop all threads if one fails ThreadGroup threadGroup = new ThreadGroup("foo") { @@ -732,7 +732,7 @@ } } - long time = System.currentTimeMillis() - startTime; + long time = timeStamp() - startTime; System.out.println("Multithread test time = " + time + " ms. Threads: " + pts.length + ". Hold time: " + holdTime @@ -756,6 +756,7 @@ + ". Loops: " + pt.loops + ". State: " + pt.state + ". thrown: "+ pt.thrown + + ". (using nanoTime)" ); } } @@ -811,7 +812,7 @@ thread = new Thread(threadGroup, this, "Thread+" + currentThreadCount++); thread.setDaemon(false); - created = System.currentTimeMillis(); + created = timeStamp(); } public void start(){ @@ -819,14 +820,14 @@ } public void run() { - started = System.currentTimeMillis(); + started = timeStamp(); try { while (isRun) { loops++; state = "Getting Connection"; - preconnected = System.currentTimeMillis(); + preconnected = timeStamp(); Connection conn = getConnection(); - connected = System.currentTimeMillis(); + connected = timeStamp(); state = "Using Connection"; assertNotNull(conn); PreparedStatement stmt = @@ -855,7 +856,7 @@ throw new RuntimeException(); } } finally { - ended = System.currentTimeMillis(); + ended = timeStamp(); } } @@ -867,4 +868,8 @@ return thread; } } + + long timeStamp() { + return System.nanoTime() / 1000000; + } }