You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2008/06/15 09:24:13 UTC
svn commit: r667931 - in
/commons/sandbox/performance/trunk/src/java/org/apache/commons/performance:
ClientThread.java Statistics.java pool/PoolClientThread.java
Author: psteitz
Date: Sun Jun 15 00:24:12 2008
New Revision: 667931
URL: http://svn.apache.org/viewvc?rev=667931&view=rev
Log:
Eliminated unintended override of finalize.
Modified:
commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/ClientThread.java
commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/Statistics.java
commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java
Modified: commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/ClientThread.java
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/ClientThread.java?rev=667931&r1=667930&r2=667931&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/ClientThread.java (original)
+++ commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/ClientThread.java Sun Jun 15 00:24:12 2008
@@ -27,7 +27,8 @@
* <p>Base for performance / load test clients.
* The run method executes init, then setup-execute-cleanup in a loop,
* gathering performance statistics, with time between executions based
- * on configuration parameters. See {@link #nextDelay()} for details on
+ * on configuration parameters. The <code>finish</code> method is executed once
+ * at the end of a run. See {@link #nextDelay()} for details on
* inter-arrival time computation.</p>
*
* <p>Subclasses <strong>must</strong> implement <code>execute</code>, which
@@ -37,7 +38,12 @@
* <code>setUp</code> and put the setup code there. Similarly for
* <code>cleanUp</code>. Initialization code that needs to be executed once
* only, before any requests are initiated, should be put into
- * <code>init.</code></p>
+ * <code>init</code> and cleanup code that needs to be executed only once
+ * at the end of a simulation should be put into <code>finish.</code></p>
+ *
+ * <p>By default, the only statistics accumulated are for the latency of the
+ * <code>execute</code> method. Additional metrics can be captured and added
+ * to the {@link Statistics} for the running thread.</p>
*
*/
public abstract class ClientThread implements Runnable {
@@ -172,7 +178,7 @@
}
try {
- finalize();
+ finish();
} catch (Exception ex) {
logger.severe("finalize failed.");
ex.printStackTrace();
@@ -201,7 +207,7 @@
protected void cleanUp() throws Exception {}
/** Executed once after the run finishes */
- protected void finalize() throws Exception {}
+ protected void finish() throws Exception {}
/**
* Core iteration code. Timings are based on this,
Modified: commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/Statistics.java
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/Statistics.java?rev=667931&r1=667930&r2=667931&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/Statistics.java (original)
+++ commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/Statistics.java Sun Jun 15 00:24:12 2008
@@ -26,9 +26,12 @@
* <p>Container for {@link SummaryStatistics} accumulated during
* {@link ClientThread} executions.</p>
*
- * <p>Maintains a HashMap of SummaryStatistics instances with a composite
- * key of the form <process,type>. "Process" typically identifies the client
+ * <p>Maintains a HashMap of {@link SummaryStatistics} instances with a composite
+ * key of the form (process,type). "Process" typically identifies the client
* thread and "type" identifies the metric - e.g., "latency", "numActive."</p>
+ *
+ * <p>{@link ClientThread#run()} adds one <code>SummaryStatistics</code>
+ * instance, with key = (current thread id,"latency").</p>
*
*/
public class Statistics {
Modified: commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java?rev=667931&r1=667930&r2=667931&view=diff
==============================================================================
--- commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java (original)
+++ commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java Sun Jun 15 00:24:12 2008
@@ -137,7 +137,7 @@
}
}
- protected void finalize() throws Exception {
+ protected void finish() throws Exception {
// Add pool metrics to stats
stats.addStatistics(
numIdleStats, Thread.currentThread().getName(), "numIdle");