[Proxool-cvs] proxool/src/java-test/org/logicalcobwebs/proxool DependencyCheck.java,1.1,1.2 Performa
UNMAINTAINED!
Brought to you by:
billhorsman
From: <bil...@us...> - 2003-11-04 13:54:06
|
Update of /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool In directory sc8-pr-cvs1:/tmp/cvs-serv1745/src/java-test/org/logicalcobwebs/proxool Modified Files: DependencyCheck.java PerformanceTest.java Log Message: checkstyle Index: DependencyCheck.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/DependencyCheck.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DependencyCheck.java 25 Oct 2003 18:38:17 -0000 1.1 --- DependencyCheck.java 4 Nov 2003 13:54:02 -0000 1.2 *************** *** 11,15 **** import java.sql.DriverManager; - import java.sql.SQLException; import java.util.Properties; --- 11,14 ---- *************** *** 66,69 **** --- 65,71 ---- Revision history: $Log$ + Revision 1.2 2003/11/04 13:54:02 billhorsman + checkstyle + Revision 1.1 2003/10/25 18:38:17 billhorsman Not a test, just a standalone class you can run to see what libraries you need to use Proxool. Index: PerformanceTest.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java-test/org/logicalcobwebs/proxool/PerformanceTest.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PerformanceTest.java 11 Mar 2003 14:58:32 -0000 1.16 --- PerformanceTest.java 4 Nov 2003 13:54:02 -0000 1.17 *************** *** 15,18 **** --- 15,19 ---- import java.sql.DriverManager; import java.sql.SQLException; + import java.sql.Statement; import java.util.Properties; import java.text.DecimalFormat; *************** *** 37,40 **** --- 38,42 ---- private static final int PERIOD = 5; private static final int COUNT = 6; + private long servedCount; public PerformanceTest(String s) { *************** *** 46,55 **** * @throws ProxoolException if anything goes wrong */ ! public void testPerformance() throws ProxoolException { waitingThead = Thread.currentThread(); String alias = "testPeformance"; ! int threadCount = 5; String url = TestHelper.buildProxoolUrl(alias, TestConstants.HYPERSONIC_DRIVER, --- 48,57 ---- * @throws ProxoolException if anything goes wrong */ ! public void testPerformance() throws ProxoolException, InterruptedException { waitingThead = Thread.currentThread(); String alias = "testPeformance"; ! int threadCount = 20; String url = TestHelper.buildProxoolUrl(alias, TestConstants.HYPERSONIC_DRIVER, *************** *** 59,66 **** --- 61,74 ---- info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD); info.setProperty(ProxoolConstants.MINIMUM_CONNECTION_COUNT_PROPERTY, String.valueOf(threadCount)); + info.setProperty(ProxoolConstants.VERBOSE_PROPERTY, String.valueOf(Boolean.TRUE)); + info.setProperty(ProxoolConstants.MAXIMUM_CONNECTION_COUNT_PROPERTY, String.valueOf(threadCount)); + /* info.setProperty(ProxoolConstants.STATISTICS_PROPERTY, String.valueOf(PERIOD) + "s"); info.setProperty(ProxoolConstants.STATISTICS_LOG_LEVEL_PROPERTY, ProxoolConstants.STATISTICS_LOG_LEVEL_INFO); + */ ProxoolFacade.registerConnectionPool(url, info); + /* ProxoolFacade.addStatisticsListener(alias, this); + */ doWait(); *************** *** 81,86 **** } ! LOG.info("Served " + statistics.getServedCount() ! + " at " + millisecondsFormat.format((double) (1000 * PERIOD * COUNT) / (double) statistics.getServedCount()) + " ms per connection"); } --- 89,112 ---- } ! for (int i = 0; i < 5; i++) { ! int activeConnectionCount = ProxoolFacade.getSnapshot(alias).getActiveConnectionCount(); ! if (activeConnectionCount > 0) { ! LOG.info("Waiting for 10 seconds for connections to become inactive (" + activeConnectionCount + ")"); ! Thread.sleep(10000); ! } else { ! break; ! } ! } ! ! final SnapshotIF snapshot = ProxoolFacade.getSnapshot(alias, true); ! LOG.info("Active count: " + snapshot.getActiveConnectionCount()); ! LOG.info("Available count: " + snapshot.getAvailableConnectionCount()); ! ConnectionInfoIF[] cis = snapshot.getConnectionInfos(); ! LOG.info("Found " + cis.length + " connetions with a detailed snapshot" + ""); ! for (int i = 0; i < cis.length; i++) { ! ConnectionInfoIF ci = cis[i]; ! LOG.info("#" + ci.getId() + ": " + ci.getStatus() + ", lap=" + (ci.getTimeLastStopActive() - ci.getTimeLastStartActive())); ! } ! LOG.info("Served a total of " + ProxoolFacade.getSnapshot(alias).getServedCount()); } *************** *** 97,100 **** --- 123,127 ---- public void statistics(String alias, StatisticsIF statistics) { + this.servedCount += statistics.getServedCount(); this.statistics = statistics; synchronized (waitingThead) { *************** *** 116,119 **** --- 143,147 ---- info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, TestConstants.HYPERSONIC_PASSWORD); info.setProperty(ProxoolConstants.MINIMUM_CONNECTION_COUNT_PROPERTY, String.valueOf(threadCount)); + info.setProperty(ProxoolConstants.MAXIMUM_CONNECTION_COUNT_PROPERTY, String.valueOf(threadCount)); info.setProperty(ProxoolConstants.STATISTICS_PROPERTY, String.valueOf(PERIOD) + "s"); info.setProperty(ProxoolConstants.STATISTICS_LOG_LEVEL_PROPERTY, ProxoolConstants.STATISTICS_LOG_LEVEL_INFO); *************** *** 220,230 **** } - private void checkForDisparity(int count1, int count2, String description) { - if (count1 != count2) { - LOG.error(description + " disparity: " + count1 + " != " + count2); - disparityNoticed = true; - } - } - private int getCount(ConnectionInfoIF[] connectionInfos, int status) { int count = 0; --- 248,251 ---- *************** *** 266,274 **** try { Connection connection = null; try { connection = DriverManager.getConnection(TestHelper.buildProxoolUrl(alias)); ! connection.createStatement(); Thread.yield(); } finally { if (connection != null) { connection.close(); --- 287,299 ---- try { Connection connection = null; + Statement s = null; try { connection = DriverManager.getConnection(TestHelper.buildProxoolUrl(alias)); ! s = connection.createStatement(); Thread.yield(); } finally { + if (s != null) { + s.close(); + } if (connection != null) { connection.close(); *************** *** 302,305 **** --- 327,333 ---- Revision history: $Log$ + Revision 1.17 2003/11/04 13:54:02 billhorsman + checkstyle + Revision 1.16 2003/03/11 14:58:32 billhorsman put PerformanceTest back in the global test |