activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r411019 - /incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/
Date Fri, 02 Jun 2006 02:27:13 GMT
Author: aco
Date: Thu Jun  1 19:27:12 2006
New Revision: 411019

URL: http://svn.apache.org/viewvc?rev=411019&view=rev
Log:
- Added a getClientID to retrieve the connectionID of a client
- Added a getSettings to PerfMeasurable client and remove unnecessary getters.
- Added a PerfMeasurable parameter to the listeners.

Modified:
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConfigurableClientSupport.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsPerfClientSupport.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfEventAdapter.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfEventListener.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurable.java

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConfigurableClientSupport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConfigurableClientSupport.java?rev=411019&r1=411018&r2=411019&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConfigurableClientSupport.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConfigurableClientSupport.java
Thu Jun  1 19:27:12 2006
@@ -32,6 +32,7 @@
 
     private String serverType = "";
     private String factoryClass = "";
+    private String clientID = "";
 
     private Map factorySettings    = new HashMap();
     private Map connectionSettings = new HashMap();
@@ -154,6 +155,14 @@
         return jmsMessageConsumer;
     }
 
+    public String getClientID() {
+        try {
+            return getConnection().getClientID();
+        } catch (Exception e) {
+            return "";
+        }
+    }
+
     public TopicSubscriber createDurableSubscriber(Topic dest, String name, String selector,
boolean noLocal) throws JMSException {
         jmsMessageConsumer = getSession().createDurableSubscriber(dest, name, selector, noLocal);
         configureJmsObject(jmsMessageConsumer, consumerSettings);
@@ -192,14 +201,14 @@
 
     public void addConfigParam(String key, Object value) {
         // Simple mapping of JMS Server to connection factory class
-        if (key.equalsIgnoreCase("server")) {
+        if (key.equalsIgnoreCase("client.server")) {
             serverType = value.toString();
             if (serverType.equalsIgnoreCase(AMQ_SERVER)) {
                 factoryClass = AMQ_CONNECTION_FACTORY_CLASS;
             }
 
         // Manually specify the connection factory class to use
-        } else if (key.equalsIgnoreCase("factoryClass")) {
+        } else if (key.equalsIgnoreCase("client.factoryClass")) {
             factoryClass = value.toString();
 
         // Connection factory specific settings

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsPerfClientSupport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsPerfClientSupport.java?rev=411019&r1=411018&r2=411019&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsPerfClientSupport.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsPerfClientSupport.java
Thu Jun  1 19:27:12 2006
@@ -16,13 +16,12 @@
  */
 package org.apache.activemq.tool;
 
+import java.util.Map;
+import java.util.HashMap;
+
 public class JmsPerfClientSupport extends JmsConfigurableClientSupport implements PerfMeasurable
{
 
     protected long throughput   = 0;
-    protected long interval     = 1000; // 1 sec
-    protected long duration     = 1000 * 60 * 10; // 10 min
-    protected long rampUpTime   = 1000 * 60 * 1;  // 1 min
-    protected long rampDownTime = 1000 * 60 * 1;  // 1 min
 
     protected PerfEventListener listener = null;
 
@@ -46,43 +45,28 @@
         throughput += val;
     }
 
-    public long getInterval() {
-        return interval;
-    }
-
-    public void setInterval(long val) {
-        this.interval = val;
-    }
-
-    public long getDuration() {
-        return duration;
-    }
-
-    public void setDuration(long val) {
-        this.duration = val;
-    }
-
-    public long getRampUpTime() {
-        return rampUpTime;
-    }
-
-    public void setRampUpTime(long val) {
-        this.rampUpTime = val;
-    }
-
-    public long getRampDownTime() {
-        return rampDownTime;
-    }
-
-    public void setRampDownTime(long val) {
-        this.rampDownTime = val;
-    }
-
     public void setPerfEventListener(PerfEventListener listener) {
         this.listener = listener;
     }
 
     public PerfEventListener getPerfEventListener() {
         return listener;
+    }
+
+    public Map getClientSettings() {
+        Map settings = new HashMap();
+        settings.put("client.server", getServerType());
+        settings.put("client.factoryClass", getFactoryClass());
+        settings.put("client.clientID", getClientID());
+        settings.putAll(getFactorySettings());
+        settings.putAll(getConnectionSettings());
+        settings.putAll(getSessionSettings());
+        settings.putAll(getQueueSettings());
+        settings.putAll(getTopicSettings());
+        settings.putAll(getProducerSettings());
+        settings.putAll(getConsumerSettings());
+        settings.putAll(getMessageSettings());
+
+        return settings;
     }
 }

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java?rev=411019&r1=411018&r2=411019&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java
Thu Jun  1 19:27:12 2006
@@ -80,7 +80,7 @@
 
     public void createProducer(int messageSize) throws JMSException {
 
-        listener.onConfigStart();
+        listener.onConfigStart(this);
 
         // Create connection factory
         if (factory != null) {
@@ -120,7 +120,7 @@
             message = createTextMessage(buff);
         }
 
-        listener.onConfigEnd();
+        listener.onConfigEnd(this);
     }
 
     public void sendCountBasedMessages(long messageCount) throws JMSException {
@@ -132,20 +132,22 @@
             if (message != null) {
                 // Send to more than one actual destination
                 if (dest.length > 1) {
-                    listener.onPublishStart();
+                    listener.onPublishStart(this);
                     for (int i=0; i<messageCount; i++) {
                         for (int j=0; j<dest.length; j++) {
                             getMessageProducer().send(dest[j], message);
+                            incThroughput();
                         }
                     }
-                    listener.onPublishEnd();
+                    listener.onPublishEnd(this);
                 // Send to only one actual destination
                 } else {
-                    listener.onPublishStart();
+                    listener.onPublishStart(this);
                     for (int i=0; i<messageCount; i++) {
                         getMessageProducer().send(message);
+                        incThroughput();
                     }
-                    listener.onPublishEnd();
+                    listener.onPublishEnd(this);
                 }
 
             // Send different type of messages using indexing to identify each one.
@@ -154,21 +156,23 @@
             } else {
                 // Send to more than one actual destination
                 if (dest.length > 1) {
-                    listener.onPublishStart();
+                    listener.onPublishStart(this);
                     for (int i=0; i<messageCount; i++) {
                         for (int j=0; j<dest.length; j++) {
                             getMessageProducer().send(dest[j], createTextMessage("Text Message
[" + i + "]"));
+                            incThroughput();
                         }
                     }
-                    listener.onPublishEnd();
+                    listener.onPublishEnd(this);
 
                 // Send to only one actual destination
                 } else {
-                    listener.onPublishStart();
+                    listener.onPublishStart(this);
                     for (int i=0; i<messageCount; i++) {
                         getMessageProducer().send(createTextMessage("Text Message [" + i
+ "]"));
+                        incThroughput();
                     }
-                    listener.onPublishEnd();
+                    listener.onPublishEnd(this);
                 }
             }
         } finally {
@@ -188,20 +192,22 @@
             if (message != null) {
                 // Send to more than one actual destination
                 if (dest.length > 1) {
-                    listener.onPublishStart();
+                    listener.onPublishStart(this);
                     while (System.currentTimeMillis() < endTime) {
                         for (int j=0; j<dest.length; j++) {
                             getMessageProducer().send(dest[j], message);
+                            incThroughput();
                         }
                     }
-                    listener.onPublishEnd();
+                    listener.onPublishEnd(this);
                 // Send to only one actual destination
                 } else {
-                    listener.onPublishStart();
+                    listener.onPublishStart(this);
                     while (System.currentTimeMillis() < endTime) {
                         getMessageProducer().send(message);
+                        incThroughput();
                     }
-                    listener.onPublishEnd();
+                    listener.onPublishEnd(this);
                 }
 
             // Send different type of messages using indexing to identify each one.
@@ -211,21 +217,23 @@
                 // Send to more than one actual destination
                 long count = 1;
                 if (dest.length > 1) {
-                    listener.onPublishStart();
+                    listener.onPublishStart(this);
                     while (System.currentTimeMillis() < endTime) {
                         for (int j=0; j<dest.length; j++) {
                             getMessageProducer().send(dest[j], createTextMessage("Text Message
[" + count++ + "]"));
+                            incThroughput();
                         }
                     }
-                    listener.onPublishEnd();
+                    listener.onPublishEnd(this);
 
                 // Send to only one actual destination
                 } else {
-                    listener.onPublishStart();
+                    listener.onPublishStart(this);
                     while (System.currentTimeMillis() < endTime) {
                         getMessageProducer().send(createTextMessage("Text Message [" + count++
+ "]"));
+                        incThroughput();
                     }
-                    listener.onPublishEnd();
+                    listener.onPublishEnd(this);
                 }
             }
         } finally {

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfEventAdapter.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfEventAdapter.java?rev=411019&r1=411018&r2=411019&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfEventAdapter.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfEventAdapter.java
Thu Jun  1 19:27:12 2006
@@ -19,27 +19,27 @@
 import javax.jms.JMSException;
 
 public class PerfEventAdapter implements PerfEventListener {
-    public void onConfigStart() {
+    public void onConfigStart(PerfMeasurable client) {
     }
 
-    public void onConfigEnd() {
+    public void onConfigEnd(PerfMeasurable client) {
     }
 
-    public void onPublishStart() {
+    public void onPublishStart(PerfMeasurable client) {
     }
 
-    public void onPublishEnd() {
+    public void onPublishEnd(PerfMeasurable client) {
     }
 
-    public void onConsumeStart() {
+    public void onConsumeStart(PerfMeasurable client) {
     }
 
-    public void onConsumeEnd() {
+    public void onConsumeEnd(PerfMeasurable client) {
     }
 
-    public void onJMSException(JMSException e) {
+    public void onJMSException(PerfMeasurable client, JMSException e) {
     }
 
-    public void onException(Exception e) {
+    public void onException(PerfMeasurable client, Exception e) {
     }
 }

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfEventListener.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfEventListener.java?rev=411019&r1=411018&r2=411019&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfEventListener.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfEventListener.java
Thu Jun  1 19:27:12 2006
@@ -19,12 +19,12 @@
 import javax.jms.JMSException;
 
 public interface PerfEventListener {
-    public void onConfigStart();
-    public void onConfigEnd();
-    public void onPublishStart();
-    public void onPublishEnd();
-    public void onConsumeStart();
-    public void onConsumeEnd();
-    public void onJMSException(JMSException e);
-    public void onException(Exception e);
+    public void onConfigStart(PerfMeasurable client);
+    public void onConfigEnd(PerfMeasurable client);
+    public void onPublishStart(PerfMeasurable client);
+    public void onPublishEnd(PerfMeasurable client);
+    public void onConsumeStart(PerfMeasurable client);
+    public void onConsumeEnd(PerfMeasurable client);
+    public void onJMSException(PerfMeasurable client, JMSException e);
+    public void onException(PerfMeasurable client, Exception e);
 }

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurable.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurable.java?rev=411019&r1=411018&r2=411019&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurable.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurable.java
Thu Jun  1 19:27:12 2006
@@ -16,13 +16,12 @@
  */
 package org.apache.activemq.tool;
 
+import java.util.Map;
+
 public interface PerfMeasurable {
     public void reset();
     public long getThroughput();
-    public long getInterval();
-    public long getDuration();
-    public long getRampUpTime();
-    public long getRampDownTime();
+    public Map  getClientSettings();
     public void setPerfEventListener(PerfEventListener listener);
     public PerfEventListener getPerfEventListener();
 }



Mime
View raw message