activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r419366 [6/7] - in /incubator/activemq/trunk: activeio/activeio-core/src/main/java/org/apache/activeio/journal/active/ activemq-core/src/main/java/org/apache/activemq/broker/ activemq-core/src/main/java/org/apache/activemq/command/ activemq...
Date Wed, 05 Jul 2006 22:30:26 GMT
Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/ThroughputReportPlugin.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/ThroughputReportPlugin.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/ThroughputReportPlugin.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/ThroughputReportPlugin.java Wed Jul  5 15:30:19 2006
@@ -1,182 +1,182 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.tool.reports.plugins;
-
-import org.apache.activemq.tool.reports.PerformanceStatisticsUtil;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.StringTokenizer;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Set;
-import java.util.Iterator;
-
-public class ThroughputReportPlugin implements ReportPlugin {
-    public static final String KEY_SYS_TOTAL_TP          = "SystemTotalTP";
-    public static final String KEY_SYS_TOTAL_CLIENTS     = "SystemTotalClients";
-    public static final String KEY_SYS_AVE_TP            = "SystemAveTP";
-    public static final String KEY_SYS_AVE_EMM_TP        = "SystemAveEMMTP";
-    public static final String KEY_SYS_AVE_CLIENT_TP     = "SystemAveClientTP";
-    public static final String KEY_SYS_AVE_CLIENT_EMM_TP = "SystemAveClientEMMTP";
-    public static final String KEY_MIN_CLIENT_TP = "MinClientTP";
-    public static final String KEY_MAX_CLIENT_TP = "MaxClientTP";
-    public static final String KEY_MIN_CLIENT_TOTAL_TP = "MinClientTotalTP";
-    public static final String KEY_MAX_CLIENT_TOTAL_TP = "MaxClientTotalTP";
-    public static final String KEY_MIN_CLIENT_AVE_TP = "MinClientAveTP";
-    public static final String KEY_MAX_CLIENT_AVE_TP = "MaxClientAveTP";
-    public static final String KEY_MIN_CLIENT_AVE_EMM_TP = "MinClientAveEMMTP";
-    public static final String KEY_MAX_CLIENT_AVE_EMM_TP = "MaxClientAveEMMTP";
-
-    protected Map clientThroughputs = new HashMap();
-
-    public void handleCsvData(String csvData) {
-        StringTokenizer tokenizer = new StringTokenizer(csvData, ",");
-        String data, key, val, clientName = null;
-        Long throughput = null;
-        while (tokenizer.hasMoreTokens()) {
-            data = tokenizer.nextToken();
-            key  = data.substring(0, data.indexOf("="));
-            val  = data.substring(data.indexOf("=") + 1);
-
-            if (key.equalsIgnoreCase("clientName")) {
-                clientName = val;
-            } else if (key.equalsIgnoreCase("throughput")) {
-                throughput = Long.valueOf(val);
-            } else {
-                // Ignore unknown token
-            }
-        }
-        addToClientTPList(clientName, throughput);
-    }
-
-    public Map getSummary() {
-        long   minClientTP = Long.MAX_VALUE, // TP = throughput
-               maxClientTP = Long.MIN_VALUE,
-               minClientTotalTP = Long.MAX_VALUE,
-               maxClientTotalTP = Long.MIN_VALUE,
-               systemTotalTP = 0;
-
-        double minClientAveTP = Double.MAX_VALUE,
-               maxClientAveTP = Double.MIN_VALUE,
-               minClientAveEMMTP = Double.MAX_VALUE, // EMM = Excluding Min/Max
-               maxClientAveEMMTP = Double.MIN_VALUE,
-               systemAveTP = 0.0,
-               systemAveEMMTP = 0.0;
-
-        String nameMinClientTP = "",
-               nameMaxClientTP = "",
-               nameMinClientTotalTP = "",
-               nameMaxClientTotalTP = "",
-               nameMinClientAveTP = "",
-               nameMaxClientAveTP = "",
-               nameMinClientAveEMMTP = "",
-               nameMaxClientAveEMMTP = "";
-
-        Set clientNames = clientThroughputs.keySet();
-        String clientName;
-        List   clientTPList;
-        long tempLong;
-        double tempDouble;
-        int clientCount = 0;
-        for (Iterator i=clientNames.iterator(); i.hasNext();) {
-            clientName = (String)i.next();
-            clientTPList = (List)clientThroughputs.get(clientName);
-            clientCount++;
-
-            tempLong = PerformanceStatisticsUtil.getMinThroughput(clientTPList);
-            if (tempLong < minClientTP) {
-                minClientTP = tempLong;
-                nameMinClientTP = clientName;
-            }
-
-            tempLong = PerformanceStatisticsUtil.getMaxThroughput(clientTPList);
-            if (tempLong > maxClientTP) {
-                maxClientTP = tempLong;
-                nameMaxClientTP = clientName;
-            }
-
-            tempLong = PerformanceStatisticsUtil.getTotalThroughput(clientTPList);
-            systemTotalTP += tempLong; // Accumulate total TP
-            if (tempLong < minClientTotalTP) {
-                minClientTotalTP = tempLong;
-                nameMinClientTotalTP = clientName;
-            }
-
-            if (tempLong > maxClientTotalTP) {
-                maxClientTotalTP = tempLong;
-                nameMaxClientTotalTP = clientName;
-            }
-
-            tempDouble = PerformanceStatisticsUtil.getAveThroughput(clientTPList);
-            systemAveTP += tempDouble; // Accumulate ave throughput
-            if (tempDouble < minClientAveTP) {
-                minClientAveTP = tempDouble;
-                nameMinClientAveTP = clientName;
-            }
-
-            if (tempDouble > maxClientAveTP) {
-                maxClientAveTP = tempDouble;
-                nameMaxClientAveTP = clientName;
-            }
-
-            tempDouble = PerformanceStatisticsUtil.getAveThroughputExcludingMinMax(clientTPList);
-            systemAveEMMTP += tempDouble; // Accumulate ave throughput excluding min/max
-            if (tempDouble < minClientAveEMMTP) {
-                minClientAveEMMTP = tempDouble;
-                nameMinClientAveEMMTP = clientName;
-            }
-
-            if (tempDouble > maxClientAveEMMTP) {
-                maxClientAveEMMTP = tempDouble;
-                nameMaxClientAveEMMTP = clientName;
-            }
-        }
-
-        Map summary = new HashMap();
-        summary.put(KEY_SYS_TOTAL_TP, String.valueOf(systemTotalTP));
-        summary.put(KEY_SYS_TOTAL_CLIENTS, String.valueOf(clientCount));
-        summary.put(KEY_SYS_AVE_TP, String.valueOf(systemAveTP));
-        summary.put(KEY_SYS_AVE_EMM_TP, String.valueOf(systemAveEMMTP));
-        summary.put(KEY_SYS_AVE_CLIENT_TP, String.valueOf(systemAveTP / clientCount));
-        summary.put(KEY_SYS_AVE_CLIENT_EMM_TP, String.valueOf(systemAveEMMTP / clientCount));
-        summary.put(KEY_MIN_CLIENT_TP, nameMinClientTP + "=" + minClientTP);
-        summary.put(KEY_MAX_CLIENT_TP, nameMaxClientTP + "=" + maxClientTP);
-        summary.put(KEY_MIN_CLIENT_TOTAL_TP, nameMinClientTotalTP + "=" + minClientTotalTP);
-        summary.put(KEY_MAX_CLIENT_TOTAL_TP, nameMaxClientTotalTP + "=" + maxClientTotalTP);
-        summary.put(KEY_MIN_CLIENT_AVE_TP, nameMinClientAveTP + "=" + minClientAveTP);
-        summary.put(KEY_MAX_CLIENT_AVE_TP, nameMaxClientAveTP + "=" + maxClientAveTP);
-        summary.put(KEY_MIN_CLIENT_AVE_EMM_TP, nameMinClientAveEMMTP + "=" + minClientAveEMMTP);
-        summary.put(KEY_MAX_CLIENT_AVE_EMM_TP, nameMaxClientAveEMMTP + "=" + maxClientAveEMMTP);
-
-        return summary;
-    }
-
-    protected void addToClientTPList(String clientName, Long throughput) {
-        // Write to client's throughput list
-        if (clientName == null || throughput == null) {
-            throw new IllegalArgumentException("Invalid Throughput CSV Data: clientName=" + clientName + ", throughput=" + throughput);
-        }
-
-        List clientTPList = (List)clientThroughputs.get(clientName);
-        if (clientTPList == null) {
-            clientTPList = new ArrayList();
-            clientThroughputs.put(clientName, clientTPList);
-        }
-        clientTPList.add(throughput);
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.tool.reports.plugins;
+
+import org.apache.activemq.tool.reports.PerformanceStatisticsUtil;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.StringTokenizer;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Set;
+import java.util.Iterator;
+
+public class ThroughputReportPlugin implements ReportPlugin {
+    public static final String KEY_SYS_TOTAL_TP          = "SystemTotalTP";
+    public static final String KEY_SYS_TOTAL_CLIENTS     = "SystemTotalClients";
+    public static final String KEY_SYS_AVE_TP            = "SystemAveTP";
+    public static final String KEY_SYS_AVE_EMM_TP        = "SystemAveEMMTP";
+    public static final String KEY_SYS_AVE_CLIENT_TP     = "SystemAveClientTP";
+    public static final String KEY_SYS_AVE_CLIENT_EMM_TP = "SystemAveClientEMMTP";
+    public static final String KEY_MIN_CLIENT_TP = "MinClientTP";
+    public static final String KEY_MAX_CLIENT_TP = "MaxClientTP";
+    public static final String KEY_MIN_CLIENT_TOTAL_TP = "MinClientTotalTP";
+    public static final String KEY_MAX_CLIENT_TOTAL_TP = "MaxClientTotalTP";
+    public static final String KEY_MIN_CLIENT_AVE_TP = "MinClientAveTP";
+    public static final String KEY_MAX_CLIENT_AVE_TP = "MaxClientAveTP";
+    public static final String KEY_MIN_CLIENT_AVE_EMM_TP = "MinClientAveEMMTP";
+    public static final String KEY_MAX_CLIENT_AVE_EMM_TP = "MaxClientAveEMMTP";
+
+    protected Map clientThroughputs = new HashMap();
+
+    public void handleCsvData(String csvData) {
+        StringTokenizer tokenizer = new StringTokenizer(csvData, ",");
+        String data, key, val, clientName = null;
+        Long throughput = null;
+        while (tokenizer.hasMoreTokens()) {
+            data = tokenizer.nextToken();
+            key  = data.substring(0, data.indexOf("="));
+            val  = data.substring(data.indexOf("=") + 1);
+
+            if (key.equalsIgnoreCase("clientName")) {
+                clientName = val;
+            } else if (key.equalsIgnoreCase("throughput")) {
+                throughput = Long.valueOf(val);
+            } else {
+                // Ignore unknown token
+            }
+        }
+        addToClientTPList(clientName, throughput);
+    }
+
+    public Map getSummary() {
+        long   minClientTP = Long.MAX_VALUE, // TP = throughput
+               maxClientTP = Long.MIN_VALUE,
+               minClientTotalTP = Long.MAX_VALUE,
+               maxClientTotalTP = Long.MIN_VALUE,
+               systemTotalTP = 0;
+
+        double minClientAveTP = Double.MAX_VALUE,
+               maxClientAveTP = Double.MIN_VALUE,
+               minClientAveEMMTP = Double.MAX_VALUE, // EMM = Excluding Min/Max
+               maxClientAveEMMTP = Double.MIN_VALUE,
+               systemAveTP = 0.0,
+               systemAveEMMTP = 0.0;
+
+        String nameMinClientTP = "",
+               nameMaxClientTP = "",
+               nameMinClientTotalTP = "",
+               nameMaxClientTotalTP = "",
+               nameMinClientAveTP = "",
+               nameMaxClientAveTP = "",
+               nameMinClientAveEMMTP = "",
+               nameMaxClientAveEMMTP = "";
+
+        Set clientNames = clientThroughputs.keySet();
+        String clientName;
+        List   clientTPList;
+        long tempLong;
+        double tempDouble;
+        int clientCount = 0;
+        for (Iterator i=clientNames.iterator(); i.hasNext();) {
+            clientName = (String)i.next();
+            clientTPList = (List)clientThroughputs.get(clientName);
+            clientCount++;
+
+            tempLong = PerformanceStatisticsUtil.getMinThroughput(clientTPList);
+            if (tempLong < minClientTP) {
+                minClientTP = tempLong;
+                nameMinClientTP = clientName;
+            }
+
+            tempLong = PerformanceStatisticsUtil.getMaxThroughput(clientTPList);
+            if (tempLong > maxClientTP) {
+                maxClientTP = tempLong;
+                nameMaxClientTP = clientName;
+            }
+
+            tempLong = PerformanceStatisticsUtil.getTotalThroughput(clientTPList);
+            systemTotalTP += tempLong; // Accumulate total TP
+            if (tempLong < minClientTotalTP) {
+                minClientTotalTP = tempLong;
+                nameMinClientTotalTP = clientName;
+            }
+
+            if (tempLong > maxClientTotalTP) {
+                maxClientTotalTP = tempLong;
+                nameMaxClientTotalTP = clientName;
+            }
+
+            tempDouble = PerformanceStatisticsUtil.getAveThroughput(clientTPList);
+            systemAveTP += tempDouble; // Accumulate ave throughput
+            if (tempDouble < minClientAveTP) {
+                minClientAveTP = tempDouble;
+                nameMinClientAveTP = clientName;
+            }
+
+            if (tempDouble > maxClientAveTP) {
+                maxClientAveTP = tempDouble;
+                nameMaxClientAveTP = clientName;
+            }
+
+            tempDouble = PerformanceStatisticsUtil.getAveThroughputExcludingMinMax(clientTPList);
+            systemAveEMMTP += tempDouble; // Accumulate ave throughput excluding min/max
+            if (tempDouble < minClientAveEMMTP) {
+                minClientAveEMMTP = tempDouble;
+                nameMinClientAveEMMTP = clientName;
+            }
+
+            if (tempDouble > maxClientAveEMMTP) {
+                maxClientAveEMMTP = tempDouble;
+                nameMaxClientAveEMMTP = clientName;
+            }
+        }
+
+        Map summary = new HashMap();
+        summary.put(KEY_SYS_TOTAL_TP, String.valueOf(systemTotalTP));
+        summary.put(KEY_SYS_TOTAL_CLIENTS, String.valueOf(clientCount));
+        summary.put(KEY_SYS_AVE_TP, String.valueOf(systemAveTP));
+        summary.put(KEY_SYS_AVE_EMM_TP, String.valueOf(systemAveEMMTP));
+        summary.put(KEY_SYS_AVE_CLIENT_TP, String.valueOf(systemAveTP / clientCount));
+        summary.put(KEY_SYS_AVE_CLIENT_EMM_TP, String.valueOf(systemAveEMMTP / clientCount));
+        summary.put(KEY_MIN_CLIENT_TP, nameMinClientTP + "=" + minClientTP);
+        summary.put(KEY_MAX_CLIENT_TP, nameMaxClientTP + "=" + maxClientTP);
+        summary.put(KEY_MIN_CLIENT_TOTAL_TP, nameMinClientTotalTP + "=" + minClientTotalTP);
+        summary.put(KEY_MAX_CLIENT_TOTAL_TP, nameMaxClientTotalTP + "=" + maxClientTotalTP);
+        summary.put(KEY_MIN_CLIENT_AVE_TP, nameMinClientAveTP + "=" + minClientAveTP);
+        summary.put(KEY_MAX_CLIENT_AVE_TP, nameMaxClientAveTP + "=" + maxClientAveTP);
+        summary.put(KEY_MIN_CLIENT_AVE_EMM_TP, nameMinClientAveEMMTP + "=" + minClientAveEMMTP);
+        summary.put(KEY_MAX_CLIENT_AVE_EMM_TP, nameMaxClientAveEMMTP + "=" + maxClientAveEMMTP);
+
+        return summary;
+    }
+
+    protected void addToClientTPList(String clientName, Long throughput) {
+        // Write to client's throughput list
+        if (clientName == null || throughput == null) {
+            throw new IllegalArgumentException("Invalid Throughput CSV Data: clientName=" + clientName + ", throughput=" + throughput);
+        }
+
+        List clientTPList = (List)clientThroughputs.get(clientName);
+        if (clientTPList == null) {
+            clientTPList = new ArrayList();
+            clientThroughputs.put(clientName, clientTPList);
+        }
+        clientTPList.add(throughput);
+    }
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/ThroughputReportPlugin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/AbstractPerformanceSampler.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/AbstractPerformanceSampler.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/AbstractPerformanceSampler.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/AbstractPerformanceSampler.java Wed Jul  5 15:30:19 2006
@@ -1,154 +1,154 @@
-package org.apache.activemq.tool.sampler;
-
-import org.apache.activemq.tool.reports.PerformanceReportWriter;
-import org.apache.activemq.tool.properties.AbstractObjectProperties;
-
-import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
-
-public abstract class AbstractPerformanceSampler extends AbstractObjectProperties implements PerformanceSampler {
-	protected long rampUpTime   = 30 * 1000; // 30 secs
-	protected long rampDownTime = 30 * 1000; // 30 secs
-	protected long duration     = 5 * 60 * 1000; // 5 mins
-	protected long interval     = 1000; // 1 sec
-	protected PerformanceReportWriter perfReportWriter = null;
-	protected PerformanceEventListener perfEventListener = null;
-	protected final AtomicBoolean isRunning = new AtomicBoolean(false);
-
-	protected long sampleIndex = 0;
-
-	public long getRampUpTime() {
-		return rampUpTime;
-	}
-
-	public void setRampUpTime(long rampUpTime) {
-		this.rampUpTime = rampUpTime;
-	}
-
-	public long getRampDownTime() {
-		return rampDownTime;
-	}
-
-	public void setRampDownTime(long rampDownTime) {
-		this.rampDownTime = rampDownTime;
-	}
-
-	public long getDuration() {
-		return duration;
-	}
-
-	public void setDuration(long duration) {
-		this.duration = duration;
-	}
-
-	public long getInterval() {
-		return interval;
-	}
-
-	public void setInterval(long interval) {
-		this.interval = interval;
-	}
-
-	public PerformanceReportWriter getPerfReportWriter() {
-		return perfReportWriter;
-	}
-
-	public void setPerfReportWriter(PerformanceReportWriter perfReportWriter) {
-		this.perfReportWriter = perfReportWriter;
-	}
-
-	public PerformanceEventListener getPerfEventListener() {
-		return perfEventListener;
-	}
-
-	public void setPerfEventListener(PerformanceEventListener perfEventListener) {
-		this.perfEventListener = perfEventListener;
-	}
-
-    public void startSampler() {
-        isRunning.set(true);
-        Thread t = new Thread(this);
-        t.start();
-    }
-
-    public void run() {
-        try {
-            onRampUpStart();
-            if (perfEventListener != null) {
-            	perfEventListener.onRampUpStart(this);
-            }
-
-            try {
-                Thread.sleep(rampUpTime);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-
-            onSamplerStart();
-            if (perfEventListener != null) {
-            	perfEventListener.onSamplerStart(this);
-            }
-
-            sample();
-
-            onSamplerEnd();
-            if (perfEventListener != null) {
-            	perfEventListener.onSamplerEnd(this);
-            }
-
-            try {
-                Thread.sleep(rampDownTime);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-
-            onRampDownEnd();
-            if (perfEventListener != null) {
-            	perfEventListener.onRampDownEnd(this);
-            }
-        } finally {
-            isRunning.set(false);
-            synchronized (isRunning) {
-                isRunning.notifyAll();
-            }
-        }
-	}
-
-    protected void sample() {
-        // Compute for the actual duration window of the sampler
-        long endTime = System.currentTimeMillis() + duration - rampDownTime - rampUpTime;
-
-        while (System.currentTimeMillis() < endTime) {
-            try {
-                Thread.sleep(interval);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-            sampleData();
-            sampleIndex++;
-        }
-    }
-
-    public abstract void sampleData();
-
-    public boolean isRunning() {
-		return isRunning.get();
-	}
-
-	public void waitUntilDone() {
-		while (isRunning()) {
-            try {
-                synchronized (isRunning) {
-                    isRunning.wait(0);
-                }
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-        }
-	}
-
-    // Call back functions to customize behavior of thread.
-    protected void onRampUpStart() {}
-    protected void onSamplerStart() {}
-    protected void onSamplerEnd() {}
-    protected void onRampDownEnd() {}
-}
+package org.apache.activemq.tool.sampler;
+
+import org.apache.activemq.tool.reports.PerformanceReportWriter;
+import org.apache.activemq.tool.properties.AbstractObjectProperties;
+
+import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
+
+public abstract class AbstractPerformanceSampler extends AbstractObjectProperties implements PerformanceSampler {
+	protected long rampUpTime   = 30 * 1000; // 30 secs
+	protected long rampDownTime = 30 * 1000; // 30 secs
+	protected long duration     = 5 * 60 * 1000; // 5 mins
+	protected long interval     = 1000; // 1 sec
+	protected PerformanceReportWriter perfReportWriter = null;
+	protected PerformanceEventListener perfEventListener = null;
+	protected final AtomicBoolean isRunning = new AtomicBoolean(false);
+
+	protected long sampleIndex = 0;
+
+	public long getRampUpTime() {
+		return rampUpTime;
+	}
+
+	public void setRampUpTime(long rampUpTime) {
+		this.rampUpTime = rampUpTime;
+	}
+
+	public long getRampDownTime() {
+		return rampDownTime;
+	}
+
+	public void setRampDownTime(long rampDownTime) {
+		this.rampDownTime = rampDownTime;
+	}
+
+	public long getDuration() {
+		return duration;
+	}
+
+	public void setDuration(long duration) {
+		this.duration = duration;
+	}
+
+	public long getInterval() {
+		return interval;
+	}
+
+	public void setInterval(long interval) {
+		this.interval = interval;
+	}
+
+	public PerformanceReportWriter getPerfReportWriter() {
+		return perfReportWriter;
+	}
+
+	public void setPerfReportWriter(PerformanceReportWriter perfReportWriter) {
+		this.perfReportWriter = perfReportWriter;
+	}
+
+	public PerformanceEventListener getPerfEventListener() {
+		return perfEventListener;
+	}
+
+	public void setPerfEventListener(PerformanceEventListener perfEventListener) {
+		this.perfEventListener = perfEventListener;
+	}
+
+    public void startSampler() {
+        isRunning.set(true);
+        Thread t = new Thread(this);
+        t.start();
+    }
+
+    public void run() {
+        try {
+            onRampUpStart();
+            if (perfEventListener != null) {
+            	perfEventListener.onRampUpStart(this);
+            }
+
+            try {
+                Thread.sleep(rampUpTime);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+
+            onSamplerStart();
+            if (perfEventListener != null) {
+            	perfEventListener.onSamplerStart(this);
+            }
+
+            sample();
+
+            onSamplerEnd();
+            if (perfEventListener != null) {
+            	perfEventListener.onSamplerEnd(this);
+            }
+
+            try {
+                Thread.sleep(rampDownTime);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+
+            onRampDownEnd();
+            if (perfEventListener != null) {
+            	perfEventListener.onRampDownEnd(this);
+            }
+        } finally {
+            isRunning.set(false);
+            synchronized (isRunning) {
+                isRunning.notifyAll();
+            }
+        }
+	}
+
+    protected void sample() {
+        // Compute for the actual duration window of the sampler
+        long endTime = System.currentTimeMillis() + duration - rampDownTime - rampUpTime;
+
+        while (System.currentTimeMillis() < endTime) {
+            try {
+                Thread.sleep(interval);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            sampleData();
+            sampleIndex++;
+        }
+    }
+
+    public abstract void sampleData();
+
+    public boolean isRunning() {
+		return isRunning.get();
+	}
+
+	public void waitUntilDone() {
+		while (isRunning()) {
+            try {
+                synchronized (isRunning) {
+                    isRunning.wait(0);
+                }
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+	}
+
+    // Call back functions to customize behavior of thread.
+    protected void onRampUpStart() {}
+    protected void onSamplerStart() {}
+    protected void onSamplerEnd() {}
+    protected void onRampDownEnd() {}
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/AbstractPerformanceSampler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/CpuSamplerTask.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/CpuSamplerTask.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/CpuSamplerTask.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/CpuSamplerTask.java Wed Jul  5 15:30:19 2006
@@ -1,48 +1,48 @@
-package org.apache.activemq.tool.sampler;
-
-import org.apache.activemq.tool.sampler.plugins.CpuSamplerPlugin;
-import org.apache.activemq.tool.sampler.plugins.LinuxCpuSamplerPlugin;
-import org.apache.activemq.tool.reports.plugins.ReportPlugin;
-
-import java.io.IOException;
-
-public class CpuSamplerTask extends AbstractPerformanceSampler {
-
-    private CpuSamplerPlugin plugin = null;
-
-    public void createPlugin() throws IOException {
-        createPlugin(System.getProperty("os.name"));
-    }
-
-    public void createPlugin(String osName) throws IOException {
-        if (osName == null) {
-            throw new IOException("No defined OS name found. Found: " + osName);
-        }
-
-        if (osName.equalsIgnoreCase(CpuSamplerPlugin.LINUX)) {
-            plugin = new LinuxCpuSamplerPlugin(getInterval());
-        } else {
-            throw new IOException("No CPU Sampler Plugin found for OS: " + osName + ". CPU Sampler will not be started.");
-        }
-    }
-
-    public void sampleData() {
-        if (plugin != null && perfReportWriter != null) {
-            perfReportWriter.writeCsvData(ReportPlugin.REPORT_PLUGIN_CPU, "index=" + sampleIndex + "," + plugin.getCpuUtilizationStats());
-        }
-    }
-
-    protected void onRampUpStart() {
-        super.onRampUpStart();
-        if (plugin != null) {
-            plugin.start();
-        }
-    }
-
-    protected void onRampDownEnd() {
-        super.onRampDownEnd();
-        if (plugin != null) {
-            plugin.stop();
-        }
-    }
-}
+package org.apache.activemq.tool.sampler;
+
+import org.apache.activemq.tool.sampler.plugins.CpuSamplerPlugin;
+import org.apache.activemq.tool.sampler.plugins.LinuxCpuSamplerPlugin;
+import org.apache.activemq.tool.reports.plugins.ReportPlugin;
+
+import java.io.IOException;
+
+public class CpuSamplerTask extends AbstractPerformanceSampler {
+
+    private CpuSamplerPlugin plugin = null;
+
+    public void createPlugin() throws IOException {
+        createPlugin(System.getProperty("os.name"));
+    }
+
+    public void createPlugin(String osName) throws IOException {
+        if (osName == null) {
+            throw new IOException("No defined OS name found. Found: " + osName);
+        }
+
+        if (osName.equalsIgnoreCase(CpuSamplerPlugin.LINUX)) {
+            plugin = new LinuxCpuSamplerPlugin(getInterval());
+        } else {
+            throw new IOException("No CPU Sampler Plugin found for OS: " + osName + ". CPU Sampler will not be started.");
+        }
+    }
+
+    public void sampleData() {
+        if (plugin != null && perfReportWriter != null) {
+            perfReportWriter.writeCsvData(ReportPlugin.REPORT_PLUGIN_CPU, "index=" + sampleIndex + "," + plugin.getCpuUtilizationStats());
+        }
+    }
+
+    protected void onRampUpStart() {
+        super.onRampUpStart();
+        if (plugin != null) {
+            plugin.start();
+        }
+    }
+
+    protected void onRampDownEnd() {
+        super.onRampDownEnd();
+        if (plugin != null) {
+            plugin.stop();
+        }
+    }
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/CpuSamplerTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/MeasurableClient.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/MeasurableClient.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/MeasurableClient.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/MeasurableClient.java Wed Jul  5 15:30:19 2006
@@ -1,23 +1,23 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.tool.sampler;
-
-public interface MeasurableClient {
-    public void   reset();
-    public String getClientName();
-    public long   getThroughput();
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.tool.sampler;
+
+public interface MeasurableClient {
+    public void   reset();
+    public String getClientName();
+    public long   getThroughput();
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/MeasurableClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/PerformanceEventListener.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/PerformanceEventListener.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/PerformanceEventListener.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/PerformanceEventListener.java Wed Jul  5 15:30:19 2006
@@ -1,8 +1,8 @@
-package org.apache.activemq.tool.sampler;
-
-public interface PerformanceEventListener {
-	public void onRampUpStart(PerformanceSampler sampler);
-	public void onSamplerStart(PerformanceSampler sampler);
-	public void onSamplerEnd(PerformanceSampler sampler);
-	public void onRampDownEnd(PerformanceSampler sampler);
-}
+package org.apache.activemq.tool.sampler;
+
+public interface PerformanceEventListener {
+	public void onRampUpStart(PerformanceSampler sampler);
+	public void onSamplerStart(PerformanceSampler sampler);
+	public void onSamplerEnd(PerformanceSampler sampler);
+	public void onRampDownEnd(PerformanceSampler sampler);
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/PerformanceEventListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/PerformanceSampler.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/PerformanceSampler.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/PerformanceSampler.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/PerformanceSampler.java Wed Jul  5 15:30:19 2006
@@ -1,22 +1,22 @@
-package org.apache.activemq.tool.sampler;
-
-import org.apache.activemq.tool.reports.PerformanceReportWriter;
-
-public interface PerformanceSampler extends Runnable {
-	public long getRampUpTime();
-	public void setRampUpTime(long rampUpTime);
-	public long getRampDownTime();
-	public void setRampDownTime(long rampDownTime);
-	public long getDuration();
-	public void setDuration(long duration);
-	public long getInterval();
-	public void setInterval(long interval);
-	public PerformanceReportWriter getPerfReportWriter();
-	public void setPerfReportWriter(PerformanceReportWriter writer);
-	public PerformanceEventListener getPerfEventListener();
-	public void setPerfEventListener(PerformanceEventListener listener);
-
-	public void sampleData();
-	public boolean isRunning();
-	public void waitUntilDone();
-}
+package org.apache.activemq.tool.sampler;
+
+import org.apache.activemq.tool.reports.PerformanceReportWriter;
+
+public interface PerformanceSampler extends Runnable {
+	public long getRampUpTime();
+	public void setRampUpTime(long rampUpTime);
+	public long getRampDownTime();
+	public void setRampDownTime(long rampDownTime);
+	public long getDuration();
+	public void setDuration(long duration);
+	public long getInterval();
+	public void setInterval(long interval);
+	public PerformanceReportWriter getPerfReportWriter();
+	public void setPerfReportWriter(PerformanceReportWriter writer);
+	public PerformanceEventListener getPerfEventListener();
+	public void setPerfEventListener(PerformanceEventListener listener);
+
+	public void sampleData();
+	public boolean isRunning();
+	public void waitUntilDone();
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/PerformanceSampler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/ThroughputSamplerTask.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/ThroughputSamplerTask.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/ThroughputSamplerTask.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/ThroughputSamplerTask.java Wed Jul  5 15:30:19 2006
@@ -1,39 +1,39 @@
-package org.apache.activemq.tool.sampler;
-
-import org.apache.activemq.tool.reports.plugins.ReportPlugin;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class ThroughputSamplerTask extends AbstractPerformanceSampler {
-
-    private final Object mutex = new Object();
-    private List clients = new ArrayList();
-
-    public void registerClient(MeasurableClient client) {
-        synchronized (mutex) {
-            clients.add(client);
-        }
-    }
-
-	public void sampleData() {
-		for (Iterator i = clients.iterator(); i.hasNext();) {
-            MeasurableClient client = (MeasurableClient) i.next();
-            if (perfReportWriter != null) {
-            	perfReportWriter.writeCsvData(ReportPlugin.REPORT_PLUGIN_THROUGHPUT,
-                        "index=" + sampleIndex + ",clientName=" + client.getClientName() +
-                        ",throughput=" + client.getThroughput());
-            }
-            client.reset();
-        }
-	}
-
-    protected void onSamplerStart() {
-        // Reset the throughput of the clients
-        for (Iterator i = clients.iterator(); i.hasNext();) {
-            MeasurableClient client = (MeasurableClient) i.next();
-            client.reset();
-        }
-    }
-}
+package org.apache.activemq.tool.sampler;
+
+import org.apache.activemq.tool.reports.plugins.ReportPlugin;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class ThroughputSamplerTask extends AbstractPerformanceSampler {
+
+    private final Object mutex = new Object();
+    private List clients = new ArrayList();
+
+    public void registerClient(MeasurableClient client) {
+        synchronized (mutex) {
+            clients.add(client);
+        }
+    }
+
+	public void sampleData() {
+		for (Iterator i = clients.iterator(); i.hasNext();) {
+            MeasurableClient client = (MeasurableClient) i.next();
+            if (perfReportWriter != null) {
+            	perfReportWriter.writeCsvData(ReportPlugin.REPORT_PLUGIN_THROUGHPUT,
+                        "index=" + sampleIndex + ",clientName=" + client.getClientName() +
+                        ",throughput=" + client.getThroughput());
+            }
+            client.reset();
+        }
+	}
+
+    protected void onSamplerStart() {
+        // Reset the throughput of the clients
+        for (Iterator i = clients.iterator(); i.hasNext();) {
+            MeasurableClient client = (MeasurableClient) i.next();
+            client.reset();
+        }
+    }
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/ThroughputSamplerTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/plugins/CpuSamplerPlugin.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/plugins/CpuSamplerPlugin.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/plugins/CpuSamplerPlugin.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/plugins/CpuSamplerPlugin.java Wed Jul  5 15:30:19 2006
@@ -1,21 +1,21 @@
-package org.apache.activemq.tool.sampler.plugins;
-
-public interface CpuSamplerPlugin {
-	public final static String WINDOWS_2000 = "Windows 2000";
-	public final static String WINDOWS_NT   = "Windows NT";
-	public final static String WINDOWS_XP   = "Windows XP";
-	public final static String WINDOWS_95   = "Windows 95";
-	public final static String WINDOWS_CE   = "Windows CE";
-	public final static String LINUX        = "Linux";
-	public final static String SOLARIS      = "Solaris";
-	public final static String AIX          = "AIX";
-	public final static String FREEBSD      = "FreeBSD";
-	public final static String MAC_OS       = "Mac OS";
-	public final static String MAC_OS_X     = "Mac OS X";
-	public final static String POWERPC      = "PowerPC";
-	public final static String OS_2         = "OS/2";
-
-	public String getCpuUtilizationStats();
-    public void start();
-    public void stop();
-}
+package org.apache.activemq.tool.sampler.plugins;
+
+public interface CpuSamplerPlugin {
+	public final static String WINDOWS_2000 = "Windows 2000";
+	public final static String WINDOWS_NT   = "Windows NT";
+	public final static String WINDOWS_XP   = "Windows XP";
+	public final static String WINDOWS_95   = "Windows 95";
+	public final static String WINDOWS_CE   = "Windows CE";
+	public final static String LINUX        = "Linux";
+	public final static String SOLARIS      = "Solaris";
+	public final static String AIX          = "AIX";
+	public final static String FREEBSD      = "FreeBSD";
+	public final static String MAC_OS       = "Mac OS";
+	public final static String MAC_OS_X     = "Mac OS X";
+	public final static String POWERPC      = "PowerPC";
+	public final static String OS_2         = "OS/2";
+
+	public String getCpuUtilizationStats();
+    public void start();
+    public void stop();
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/plugins/CpuSamplerPlugin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/plugins/LinuxCpuSamplerPlugin.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/plugins/LinuxCpuSamplerPlugin.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/plugins/LinuxCpuSamplerPlugin.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/plugins/LinuxCpuSamplerPlugin.java Wed Jul  5 15:30:19 2006
@@ -1,93 +1,93 @@
-package org.apache.activemq.tool.sampler.plugins;
-
-import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.IOException;
-import java.util.StringTokenizer;
-
-public class LinuxCpuSamplerPlugin implements CpuSamplerPlugin, Runnable {
-
-    private Process vmstatProcess;
-    private String vmstat;
-    private String result = "";
-    private final Object mutex = new Object();
-    private AtomicBoolean stop = new AtomicBoolean(false);
-
-    public LinuxCpuSamplerPlugin(long intervalInMs) {
-        vmstat = "vmstat -n " + (int)(intervalInMs / 1000);
-    }
-
-    public void start() {
-        stop.set(false);
-        Thread t = new Thread(this);
-        t.start();
-    }
-
-    public void stop() {
-        stop.set(true);
-        try {
-            vmstatProcess.waitFor();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public void run() {
-
-        try {
-            vmstatProcess = Runtime.getRuntime().exec(vmstat);
-            BufferedReader br = new BufferedReader(new InputStreamReader(vmstatProcess.getInputStream()), 1024);
-
-            br.readLine(); // throw away the first line
-
-            String header = br.readLine();
-            String data;
-
-            while (!stop.get()) {
-                data = br.readLine();
-                if (data != null) {
-                    String csvData = convertToCSV(header, data);
-                    synchronized (mutex) {
-                        result = csvData;
-                    }
-                }
-            }
-            br.close();
-            vmstatProcess.destroy();
-
-        } catch (IOException ioe) {
-            ioe.printStackTrace();
-        }
-    }
-
-    public String getCpuUtilizationStats() {
-        String data;
-        synchronized (mutex) {
-            data = result;
-            result = "";
-        }
-        return data;
-    }
-
-	public String getVmstat() {
-		return vmstat;
-	}
-
-	public void setVmstat(String vmstat) {
-		this.vmstat = vmstat;
-	}
-
-    protected String convertToCSV(String header, String data) {
-		StringTokenizer headerTokens = new StringTokenizer(header, " ");
-		StringTokenizer dataTokens   = new StringTokenizer(data, " ");
-
-		String csv = "";
-		while (headerTokens.hasMoreTokens()) {
-			csv += (headerTokens.nextToken() + "=" + dataTokens.nextToken() + ",");
-		}
-
-		return csv;
-	}
-}
+package org.apache.activemq.tool.sampler.plugins;
+
+import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.util.StringTokenizer;
+
+public class LinuxCpuSamplerPlugin implements CpuSamplerPlugin, Runnable {
+
+    private Process vmstatProcess;
+    private String vmstat;
+    private String result = "";
+    private final Object mutex = new Object();
+    private AtomicBoolean stop = new AtomicBoolean(false);
+
+    public LinuxCpuSamplerPlugin(long intervalInMs) {
+        vmstat = "vmstat -n " + (int)(intervalInMs / 1000);
+    }
+
+    public void start() {
+        stop.set(false);
+        Thread t = new Thread(this);
+        t.start();
+    }
+
+    public void stop() {
+        stop.set(true);
+        try {
+            vmstatProcess.waitFor();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void run() {
+
+        try {
+            vmstatProcess = Runtime.getRuntime().exec(vmstat);
+            BufferedReader br = new BufferedReader(new InputStreamReader(vmstatProcess.getInputStream()), 1024);
+
+            br.readLine(); // throw away the first line
+
+            String header = br.readLine();
+            String data;
+
+            while (!stop.get()) {
+                data = br.readLine();
+                if (data != null) {
+                    String csvData = convertToCSV(header, data);
+                    synchronized (mutex) {
+                        result = csvData;
+                    }
+                }
+            }
+            br.close();
+            vmstatProcess.destroy();
+
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+        }
+    }
+
+    public String getCpuUtilizationStats() {
+        String data;
+        synchronized (mutex) {
+            data = result;
+            result = "";
+        }
+        return data;
+    }
+
+	public String getVmstat() {
+		return vmstat;
+	}
+
+	public void setVmstat(String vmstat) {
+		this.vmstat = vmstat;
+	}
+
+    protected String convertToCSV(String header, String data) {
+		StringTokenizer headerTokens = new StringTokenizer(header, " ");
+		StringTokenizer dataTokens   = new StringTokenizer(data, " ");
+
+		String csv = "";
+		while (headerTokens.hasMoreTokens()) {
+			csv += (headerTokens.nextToken() + "=" + dataTokens.nextToken() + ",");
+		}
+
+		return csv;
+	}
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/sampler/plugins/LinuxCpuSamplerPlugin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ActiveMQPojoSPI.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ActiveMQPojoSPI.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ActiveMQPojoSPI.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ActiveMQPojoSPI.java Wed Jul  5 15:30:19 2006
@@ -1,139 +1,139 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.tool.spi;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-
-import javax.jms.ConnectionFactory;
-import java.util.Properties;
-
-public class ActiveMQPojoSPI implements SPIConnectionFactory {
-    public static final String KEY_BROKER_URL        = "brokerUrl";
-    public static final String KEY_USERNAME          = "username";
-    public static final String KEY_PASSWORD          = "password";
-    public static final String KEY_CLIENT_ID         = "clientID";
-
-    public static final String KEY_ASYNC_SEND        = "asyncSend";
-    public static final String KEY_ASYNC_DISPATCH    = "asyncDispatch";
-    public static final String KEY_ASYNC_SESSION     = "asyncSession";
-    public static final String KEY_CLOSE_TIMEOUT     = "closeTimeout";
-    public static final String KEY_COPY_MSG_ON_SEND  = "copyMsgOnSend";
-    public static final String KEY_DISABLE_TIMESTAMP = "disableTimestamp";
-    public static final String KEY_DEFER_OBJ_SERIAL  = "deferObjSerial";
-    public static final String KEY_OPTIM_ACK         = "optimAck";
-    public static final String KEY_OPTIM_DISPATCH    = "optimDispatch";
-    public static final String KEY_PREFETCH_QUEUE    = "prefetchQueue";
-    public static final String KEY_PREFETCH_TOPIC    = "prefetchTopic";
-    public static final String KEY_USE_COMPRESSION   = "useCompression";
-    public static final String KEY_USE_RETROACTIVE   = "useRetroactive";
-
-    public ConnectionFactory createConnectionFactory(Properties settings) throws Exception {
-        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
-        configureConnectionFactory(factory, settings);
-        return factory;
-    }
-
-    public void configureConnectionFactory(ConnectionFactory jmsFactory, Properties settings) throws Exception {
-        ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory)jmsFactory;
-        String setting;
-
-        setting = settings.getProperty(KEY_BROKER_URL);
-        if (setting != null && setting.length() > 0) {
-            factory.setBrokerURL(setting);
-        }
-
-        setting = settings.getProperty(KEY_USERNAME);
-        if (setting != null && setting.length() > 0) {
-            factory.setUserName(setting);
-        }
-
-        setting = settings.getProperty(KEY_PASSWORD);
-        if (setting != null && setting.length() > 0) {
-            factory.setPassword(setting);
-        }
-
-        setting = settings.getProperty(KEY_CLIENT_ID);
-        if (setting != null && setting.length() > 0) {
-            factory.setClientID(setting);
-        }
-
-        setting = settings.getProperty(KEY_ASYNC_SEND);
-        if (setting != null && setting.length() > 0) {
-            factory.setUseAsyncSend(Boolean.getBoolean(setting));
-        }
-
-        setting = settings.getProperty(KEY_ASYNC_DISPATCH);
-        if (setting != null && setting.length() > 0) {
-            factory.setAsyncDispatch(Boolean.getBoolean(setting));
-        }
-
-        setting = settings.getProperty(KEY_ASYNC_SESSION);
-        if (setting != null && setting.length() > 0) {
-            factory.setAlwaysSessionAsync(Boolean.getBoolean(setting));
-        }
-
-        setting = settings.getProperty(KEY_CLOSE_TIMEOUT);
-        if (setting != null && setting.length() > 0) {
-            factory.setCloseTimeout(Integer.parseInt(setting));
-        }
-
-        setting = settings.getProperty(KEY_COPY_MSG_ON_SEND);
-        if (setting != null && setting.length() > 0) {
-            factory.setCopyMessageOnSend(Boolean.getBoolean(setting));
-        }
-
-        setting = settings.getProperty(KEY_DISABLE_TIMESTAMP);
-        if (setting != null && setting.length() > 0) {
-            factory.setDisableTimeStampsByDefault(Boolean.getBoolean(setting));
-        }
-
-        setting = settings.getProperty(KEY_DEFER_OBJ_SERIAL);
-        if (setting != null && setting.length() > 0) {
-            factory.setObjectMessageSerializationDefered(Boolean.getBoolean(setting));
-        }
-
-        setting = settings.getProperty(KEY_OPTIM_ACK);
-        if (setting != null && setting.length() > 0) {
-            factory.setOptimizeAcknowledge(Boolean.getBoolean(setting));
-        }
-
-        setting = settings.getProperty(KEY_OPTIM_DISPATCH);
-        if (setting != null && setting.length() > 0) {
-            factory.setOptimizedMessageDispatch(Boolean.getBoolean(setting));
-        }
-
-        setting = settings.getProperty(KEY_PREFETCH_QUEUE);
-        if (setting != null && setting.length() > 0) {
-            factory.getPrefetchPolicy().setQueuePrefetch(Integer.parseInt(setting));
-        }
-
-        setting = settings.getProperty(KEY_PREFETCH_TOPIC);
-        if (setting != null && setting.length() > 0) {
-            factory.getPrefetchPolicy().setTopicPrefetch(Integer.parseInt(setting));
-        }
-
-        setting = settings.getProperty(KEY_USE_COMPRESSION);
-        if (setting != null && setting.length() > 0) {
-            factory.setUseCompression(Boolean.getBoolean(setting));
-        }
-
-        setting = settings.getProperty(KEY_USE_RETROACTIVE);
-        if (setting != null && setting.length() > 0) {
-            factory.setUseRetroactiveConsumer(Boolean.getBoolean(setting));
-        }
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.tool.spi;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.ConnectionFactory;
+import java.util.Properties;
+
+public class ActiveMQPojoSPI implements SPIConnectionFactory {
+    public static final String KEY_BROKER_URL        = "brokerUrl";
+    public static final String KEY_USERNAME          = "username";
+    public static final String KEY_PASSWORD          = "password";
+    public static final String KEY_CLIENT_ID         = "clientID";
+
+    public static final String KEY_ASYNC_SEND        = "asyncSend";
+    public static final String KEY_ASYNC_DISPATCH    = "asyncDispatch";
+    public static final String KEY_ASYNC_SESSION     = "asyncSession";
+    public static final String KEY_CLOSE_TIMEOUT     = "closeTimeout";
+    public static final String KEY_COPY_MSG_ON_SEND  = "copyMsgOnSend";
+    public static final String KEY_DISABLE_TIMESTAMP = "disableTimestamp";
+    public static final String KEY_DEFER_OBJ_SERIAL  = "deferObjSerial";
+    public static final String KEY_OPTIM_ACK         = "optimAck";
+    public static final String KEY_OPTIM_DISPATCH    = "optimDispatch";
+    public static final String KEY_PREFETCH_QUEUE    = "prefetchQueue";
+    public static final String KEY_PREFETCH_TOPIC    = "prefetchTopic";
+    public static final String KEY_USE_COMPRESSION   = "useCompression";
+    public static final String KEY_USE_RETROACTIVE   = "useRetroactive";
+
+    public ConnectionFactory createConnectionFactory(Properties settings) throws Exception {
+        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
+        configureConnectionFactory(factory, settings);
+        return factory;
+    }
+
+    public void configureConnectionFactory(ConnectionFactory jmsFactory, Properties settings) throws Exception {
+        ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory)jmsFactory;
+        String setting;
+
+        setting = settings.getProperty(KEY_BROKER_URL);
+        if (setting != null && setting.length() > 0) {
+            factory.setBrokerURL(setting);
+        }
+
+        setting = settings.getProperty(KEY_USERNAME);
+        if (setting != null && setting.length() > 0) {
+            factory.setUserName(setting);
+        }
+
+        setting = settings.getProperty(KEY_PASSWORD);
+        if (setting != null && setting.length() > 0) {
+            factory.setPassword(setting);
+        }
+
+        setting = settings.getProperty(KEY_CLIENT_ID);
+        if (setting != null && setting.length() > 0) {
+            factory.setClientID(setting);
+        }
+
+        setting = settings.getProperty(KEY_ASYNC_SEND);
+        if (setting != null && setting.length() > 0) {
+            factory.setUseAsyncSend(Boolean.getBoolean(setting));
+        }
+
+        setting = settings.getProperty(KEY_ASYNC_DISPATCH);
+        if (setting != null && setting.length() > 0) {
+            factory.setAsyncDispatch(Boolean.getBoolean(setting));
+        }
+
+        setting = settings.getProperty(KEY_ASYNC_SESSION);
+        if (setting != null && setting.length() > 0) {
+            factory.setAlwaysSessionAsync(Boolean.getBoolean(setting));
+        }
+
+        setting = settings.getProperty(KEY_CLOSE_TIMEOUT);
+        if (setting != null && setting.length() > 0) {
+            factory.setCloseTimeout(Integer.parseInt(setting));
+        }
+
+        setting = settings.getProperty(KEY_COPY_MSG_ON_SEND);
+        if (setting != null && setting.length() > 0) {
+            factory.setCopyMessageOnSend(Boolean.getBoolean(setting));
+        }
+
+        setting = settings.getProperty(KEY_DISABLE_TIMESTAMP);
+        if (setting != null && setting.length() > 0) {
+            factory.setDisableTimeStampsByDefault(Boolean.getBoolean(setting));
+        }
+
+        setting = settings.getProperty(KEY_DEFER_OBJ_SERIAL);
+        if (setting != null && setting.length() > 0) {
+            factory.setObjectMessageSerializationDefered(Boolean.getBoolean(setting));
+        }
+
+        setting = settings.getProperty(KEY_OPTIM_ACK);
+        if (setting != null && setting.length() > 0) {
+            factory.setOptimizeAcknowledge(Boolean.getBoolean(setting));
+        }
+
+        setting = settings.getProperty(KEY_OPTIM_DISPATCH);
+        if (setting != null && setting.length() > 0) {
+            factory.setOptimizedMessageDispatch(Boolean.getBoolean(setting));
+        }
+
+        setting = settings.getProperty(KEY_PREFETCH_QUEUE);
+        if (setting != null && setting.length() > 0) {
+            factory.getPrefetchPolicy().setQueuePrefetch(Integer.parseInt(setting));
+        }
+
+        setting = settings.getProperty(KEY_PREFETCH_TOPIC);
+        if (setting != null && setting.length() > 0) {
+            factory.getPrefetchPolicy().setTopicPrefetch(Integer.parseInt(setting));
+        }
+
+        setting = settings.getProperty(KEY_USE_COMPRESSION);
+        if (setting != null && setting.length() > 0) {
+            factory.setUseCompression(Boolean.getBoolean(setting));
+        }
+
+        setting = settings.getProperty(KEY_USE_RETROACTIVE);
+        if (setting != null && setting.length() > 0) {
+            factory.setUseRetroactiveConsumer(Boolean.getBoolean(setting));
+        }
+    }
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ActiveMQPojoSPI.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ActiveMQReflectionSPI.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ActiveMQReflectionSPI.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ActiveMQReflectionSPI.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ActiveMQReflectionSPI.java Wed Jul  5 15:30:19 2006
@@ -1,23 +1,23 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.tool.spi;
-
-public class ActiveMQReflectionSPI extends ReflectionSPIConnectionFactory {
-    public String getClassName() {
-        return "org.apache.activemq.ActiveMQConnectionFactory";
-    }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.tool.spi;
+
+public class ActiveMQReflectionSPI extends ReflectionSPIConnectionFactory {
+    public String getClassName() {
+        return "org.apache.activemq.ActiveMQConnectionFactory";
+    }
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ActiveMQReflectionSPI.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ClassLoaderSPIConnectionFactory.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ClassLoaderSPIConnectionFactory.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ClassLoaderSPIConnectionFactory.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ClassLoaderSPIConnectionFactory.java Wed Jul  5 15:30:19 2006
@@ -1,84 +1,84 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.tool.spi;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.jms.ConnectionFactory;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.util.List;
-import java.util.ArrayList;
-import java.io.File;
-import java.net.URL;
-import java.net.URLClassLoader;
-
-public abstract class ClassLoaderSPIConnectionFactory implements SPIConnectionFactory {
-    private static final Log log = LogFactory.getLog(ClassLoaderSPIConnectionFactory.class);
-
-    public static final String KEY_EXT_DIR = "extDir";
-
-    public final ConnectionFactory createConnectionFactory(Properties settings) throws Exception {
-
-        // Load new context class loader
-        ClassLoader newClassLoader = getContextClassLoader(settings);
-        Thread.currentThread().setContextClassLoader(newClassLoader);
-
-        return instantiateConnectionFactory(settings);
-    }
-
-    protected ClassLoader getContextClassLoader(Properties settings) {
-        String extDir = (String)settings.remove(KEY_EXT_DIR);
-        if (extDir != null) {
-            StringTokenizer tokens = new StringTokenizer(extDir, ";,");
-            List urls = new ArrayList();
-            while (tokens.hasMoreTokens()) {
-                String dir = tokens.nextToken();
-                try {
-                    File f = new File(dir);
-                    if (!f.exists()) {
-                        log.warn("Cannot find extension dir: " + f.getAbsolutePath());
-                    } else {
-                        log.info("Adding extension dir: " + f.getAbsolutePath());
-
-                        urls.add(f.toURL());
-
-                        File[] files = f.listFiles();
-                        if( files!=null ) {
-                            for (int j = 0; j < files.length; j++) {
-                                if( files[j].getName().endsWith(".zip") || files[j].getName().endsWith(".jar") ) {
-                                    log.info("Adding extension dir: " + files[j].getAbsolutePath());
-                                    urls.add(files[j].toURL());
-                                }
-                            }
-                        }
-                    }
-                } catch (Exception e) {
-                    log.warn("Failed to load ext dir: " + dir + ". Reason: " + e);
-                }
-            }
-
-            URL u[] = new URL[urls.size()];
-            urls.toArray(u);
-            return new URLClassLoader(u, Thread.currentThread().getContextClassLoader());
-        }
-        return ClassLoaderSPIConnectionFactory.class.getClassLoader();
-    }
-
-    protected abstract ConnectionFactory instantiateConnectionFactory(Properties settings) throws Exception;
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.tool.spi;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.jms.ConnectionFactory;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.List;
+import java.util.ArrayList;
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+public abstract class ClassLoaderSPIConnectionFactory implements SPIConnectionFactory {
+    private static final Log log = LogFactory.getLog(ClassLoaderSPIConnectionFactory.class);
+
+    public static final String KEY_EXT_DIR = "extDir";
+
+    public final ConnectionFactory createConnectionFactory(Properties settings) throws Exception {
+
+        // Load new context class loader
+        ClassLoader newClassLoader = getContextClassLoader(settings);
+        Thread.currentThread().setContextClassLoader(newClassLoader);
+
+        return instantiateConnectionFactory(settings);
+    }
+
+    protected ClassLoader getContextClassLoader(Properties settings) {
+        String extDir = (String)settings.remove(KEY_EXT_DIR);
+        if (extDir != null) {
+            StringTokenizer tokens = new StringTokenizer(extDir, ";,");
+            List urls = new ArrayList();
+            while (tokens.hasMoreTokens()) {
+                String dir = tokens.nextToken();
+                try {
+                    File f = new File(dir);
+                    if (!f.exists()) {
+                        log.warn("Cannot find extension dir: " + f.getAbsolutePath());
+                    } else {
+                        log.info("Adding extension dir: " + f.getAbsolutePath());
+
+                        urls.add(f.toURL());
+
+                        File[] files = f.listFiles();
+                        if( files!=null ) {
+                            for (int j = 0; j < files.length; j++) {
+                                if( files[j].getName().endsWith(".zip") || files[j].getName().endsWith(".jar") ) {
+                                    log.info("Adding extension dir: " + files[j].getAbsolutePath());
+                                    urls.add(files[j].toURL());
+                                }
+                            }
+                        }
+                    }
+                } catch (Exception e) {
+                    log.warn("Failed to load ext dir: " + dir + ". Reason: " + e);
+                }
+            }
+
+            URL u[] = new URL[urls.size()];
+            urls.toArray(u);
+            return new URLClassLoader(u, Thread.currentThread().getContextClassLoader());
+        }
+        return ClassLoaderSPIConnectionFactory.class.getClassLoader();
+    }
+
+    protected abstract ConnectionFactory instantiateConnectionFactory(Properties settings) throws Exception;
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ClassLoaderSPIConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ReflectionSPIConnectionFactory.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ReflectionSPIConnectionFactory.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ReflectionSPIConnectionFactory.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ReflectionSPIConnectionFactory.java Wed Jul  5 15:30:19 2006
@@ -1,38 +1,38 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.tool.spi;
-
-import org.apache.activemq.tool.properties.ReflectionUtil;
-
-import javax.jms.ConnectionFactory;
-import java.util.Properties;
-
-public abstract class ReflectionSPIConnectionFactory extends ClassLoaderSPIConnectionFactory {
-
-    public ConnectionFactory instantiateConnectionFactory(Properties settings) throws Exception {
-        Class factoryClass = Thread.currentThread().getContextClassLoader().loadClass(getClassName());
-        ConnectionFactory factory = (ConnectionFactory)factoryClass.newInstance();
-        configureConnectionFactory(factory, settings);
-        return factory;
-    }
-
-    public void configureConnectionFactory(ConnectionFactory jmsFactory, Properties settings) throws Exception {
-        ReflectionUtil.configureClass(jmsFactory, settings);
-    }
-
-    public abstract String getClassName();
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.tool.spi;
+
+import org.apache.activemq.tool.properties.ReflectionUtil;
+
+import javax.jms.ConnectionFactory;
+import java.util.Properties;
+
+public abstract class ReflectionSPIConnectionFactory extends ClassLoaderSPIConnectionFactory {
+
+    public ConnectionFactory instantiateConnectionFactory(Properties settings) throws Exception {
+        Class factoryClass = Thread.currentThread().getContextClassLoader().loadClass(getClassName());
+        ConnectionFactory factory = (ConnectionFactory)factoryClass.newInstance();
+        configureConnectionFactory(factory, settings);
+        return factory;
+    }
+
+    public void configureConnectionFactory(ConnectionFactory jmsFactory, Properties settings) throws Exception {
+        ReflectionUtil.configureClass(jmsFactory, settings);
+    }
+
+    public abstract String getClassName();
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ReflectionSPIConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/SPIConnectionFactory.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/SPIConnectionFactory.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/SPIConnectionFactory.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/SPIConnectionFactory.java Wed Jul  5 15:30:19 2006
@@ -1,25 +1,25 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.tool.spi;
-
-import javax.jms.ConnectionFactory;
-import java.util.Properties;
-
-public interface SPIConnectionFactory {
-    public ConnectionFactory createConnectionFactory(Properties settings) throws Exception;
-    public void configureConnectionFactory(ConnectionFactory jmsFactory, Properties settings) throws Exception;
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.tool.spi;
+
+import javax.jms.ConnectionFactory;
+import java.util.Properties;
+
+public interface SPIConnectionFactory {
+    public ConnectionFactory createConnectionFactory(Properties settings) throws Exception;
+    public void configureConnectionFactory(ConnectionFactory jmsFactory, Properties settings) throws Exception;
+}

Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/SPIConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message