jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1519088 - in /jmeter/trunk: bin/ src/core/org/apache/jmeter/ src/core/org/apache/jmeter/engine/ src/core/org/apache/jmeter/gui/action/ src/core/org/apache/jmeter/threads/ xdocs/
Date Fri, 30 Aug 2013 21:08:17 GMT
Author: pmouawad
Date: Fri Aug 30 21:08:16 2013
New Revision: 1519088

URL: http://svn.apache.org/r1519088
Log:
Bug 54152 - In distributed testing : activeThreads and totalThreads always show 0
Bugzilla Id: 54152

Added:
    jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListener.java   (with props)
    jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java   (with
props)
    jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerTestElement.java
  (with props)
    jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerWrapper.java   (with
props)
Modified:
    jmeter/trunk/bin/saveservice.properties
    jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
    jmeter/trunk/src/core/org/apache/jmeter/engine/ConvertListeners.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/RemoteStart.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/bin/saveservice.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/saveservice.properties?rev=1519088&r1=1519087&r2=1519088&view=diff
==============================================================================
--- jmeter/trunk/bin/saveservice.properties (original)
+++ jmeter/trunk/bin/saveservice.properties Fri Aug 30 21:08:16 2013
@@ -34,7 +34,8 @@ _file_version=$Revision$
 #
 # Conversion version (for JMX output files)
 # Must be updated if the file has been changed since the previous release
-#
+# Format is:
+# Save service version=JMeter version at which change occured
 # 1.7 = 2.1.1
 # 1.8 = 2.1.2
 # (Some version updates were missed here...)
@@ -238,6 +239,7 @@ RegExUserParametersGui=org.apache.jmeter
 RemoteListenerWrapper=org.apache.jmeter.samplers.RemoteListenerWrapper
 RemoteSampleListenerWrapper=org.apache.jmeter.samplers.RemoteSampleListenerWrapper
 RemoteTestListenerWrapper=org.apache.jmeter.samplers.RemoteTestListenerWrapper
+RemoteThreadsListenerWrapper=org.apache.jmeter.threads.RemoteThreadsListenerWrapper
 ReportGui=org.apache.jmeter.control.gui.ReportGui
 ReportPage=org.apache.jmeter.testelement.ReportPage
 ReportPageGui=org.apache.jmeter.report.gui.ReportPageGui

Modified: jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java?rev=1519088&r1=1519087&r2=1519088&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/JMeter.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/JMeter.java Fri Aug 30 21:08:16 2013
@@ -77,6 +77,7 @@ import org.apache.jmeter.save.SaveServic
 import org.apache.jmeter.services.FileServer;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.testelement.TestStateListener;
+import org.apache.jmeter.threads.RemoteThreadsListenerTestElement;
 import org.apache.jmeter.util.BeanShellInterpreter;
 import org.apache.jmeter.util.BeanShellServer;
 import org.apache.jmeter.util.JMeterUtils;
@@ -784,6 +785,8 @@ public class JMeter implements JMeterPlu
                     tree.add(tree.getArray()[0], summer);
                 }
             }
+            // Used for remote notification of threads start/stop,see BUG 54152
+            tree.add(tree.getArray()[0], new RemoteThreadsListenerTestElement());
 
             List<JMeterEngine> engines = new LinkedList<JMeterEngine>();
             tree.add(tree.getArray()[0], new ListenToTest(parent, (remoteStart &&
remoteStop) ? engines : null));

Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/ConvertListeners.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/engine/ConvertListeners.java?rev=1519088&r1=1519087&r2=1519088&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/engine/ConvertListeners.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/engine/ConvertListeners.java Fri Aug 30 21:08:16
2013
@@ -30,6 +30,9 @@ import org.apache.jmeter.samplers.Sample
 import org.apache.jmeter.testelement.TestStateListener;
 import org.apache.jmeter.testelement.ThreadListener;
 import org.apache.jmeter.threads.AbstractThreadGroup;
+import org.apache.jmeter.threads.RemoteThreadsListenerImpl;
+import org.apache.jmeter.threads.RemoteThreadsListenerTestElement;
+import org.apache.jmeter.threads.RemoteThreadsListenerWrapper;
 import org.apache.jorphan.collections.HashTree;
 import org.apache.jorphan.collections.HashTreeTraverser;
 import org.apache.jorphan.logging.LoggingManager;
@@ -55,7 +58,19 @@ public class ConvertListeners implements
                 log.debug("num threads = " + ((AbstractThreadGroup) item).getNumThreads());
             }
             if (item instanceof Remoteable) {
+                if (item instanceof RemoteThreadsListenerTestElement){
+                    // Used for remote notification of threads start/stop,see BUG 54152
+                    try {
+                        RemoteThreadsListenerWrapper wrapper = new RemoteThreadsListenerWrapper(new
RemoteThreadsListenerImpl());
+                        subTree.replace(item, wrapper);
+                    } catch (RemoteException e) {
+                        log.error("Error replacing "+RemoteThreadsListenerTestElement.class.getName()

+                                +" by wrapper:"+RemoteThreadsListenerWrapper.class.getName(),
e); 
+                    }
+                    continue;
+                }
                 if (item instanceof ThreadListener){
+                    // TODO Document the reason for this
                     log.error("Cannot handle ThreadListener Remotable item "+item.getClass().getName());
                     continue;
                 }

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/RemoteStart.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/RemoteStart.java?rev=1519088&r1=1519087&r2=1519088&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/RemoteStart.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/RemoteStart.java Fri Aug 30 21:08:16
2013
@@ -30,6 +30,7 @@ import org.apache.jmeter.engine.ClientJM
 import org.apache.jmeter.engine.JMeterEngine;
 import org.apache.jmeter.engine.JMeterEngineException;
 import org.apache.jmeter.gui.GuiPackage;
+import org.apache.jmeter.threads.RemoteThreadsListenerTestElement;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.collections.HashTree;
 import org.apache.jorphan.logging.LoggingManager;
@@ -203,6 +204,8 @@ public class RemoteStart extends Abstrac
         HashTree testTree = gui.getTreeModel().getTestPlan();
         JMeter.convertSubTree(testTree);
         testTree.add(testTree.getArray()[0], gui.getMainFrame());
+        // Used for remote notification of threads start/stop,see BUG 54152
+        testTree.add(testTree.getArray()[0], new RemoteThreadsListenerTestElement());
         engine.configure(testTree);
     }
 }

Added: jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListener.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListener.java?rev=1519088&view=auto
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListener.java (added)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListener.java Fri Aug 30
21:08:16 2013
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jmeter.threads;
+
+import java.rmi.RemoteException;
+
+/**
+ * RMI Interface that allows notification of remote start/end of threads
+ * @since 2.10
+ */
+public interface RemoteThreadsListener extends java.rmi.Remote {
+    
+    /**
+     * @see ThreadListener#threadStarted()
+     * @throws RemoteException
+     */
+    void threadStarted() throws RemoteException;
+
+    /**
+     * @see ThreadListener#threadStarted()
+     */
+    void threadFinished() throws RemoteException;
+}

Propchange: jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java?rev=1519088&view=auto
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java (added)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java Fri Aug
30 21:08:16 2013
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jmeter.threads;
+
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
+import org.apache.jmeter.gui.GuiPackage;
+import org.apache.jmeter.testelement.ThreadListener;
+import org.apache.jmeter.util.JMeterUtils;
+
+/**
+ * RMI Implementation, client side code (ie executed on Controller)
+ * @since 2.10
+ */
+public class RemoteThreadsListenerImpl extends UnicastRemoteObject implements
+        RemoteThreadsListener, ThreadListener {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 4790505101521183660L;
+    /**
+     * 
+     */
+    private static final int DEFAULT_LOCAL_PORT = 
+            JMeterUtils.getPropDefault("client.rmi.localport", 0); // $NON-NLS-1$
+
+    /**
+     * @throws RemoteException
+     */
+    public RemoteThreadsListenerImpl() throws RemoteException {
+        super(DEFAULT_LOCAL_PORT);
+    }
+
+    /**
+     * 
+     * @see org.apache.jmeter.samplers.RemoteThreadsListener#threadStarted()
+     */
+    @Override
+    public void threadStarted() {
+        JMeterContextService.incrNumberOfThreads();
+        GuiPackage gp =GuiPackage.getInstance();
+        if (gp != null) {// check there is a GUI
+            gp.getMainFrame().updateCounts();
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jmeter.samplers.RemoteThreadsListener#threadFinished()
+     */
+    @Override
+    public void threadFinished() {
+        JMeterContextService.decrNumberOfThreads();
+        GuiPackage gp =GuiPackage.getInstance();
+        if (gp != null) {// check there is a GUI
+            gp.getMainFrame().updateCounts();
+        }
+    }
+}

Propchange: jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerTestElement.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerTestElement.java?rev=1519088&view=auto
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerTestElement.java
(added)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerTestElement.java
Fri Aug 30 21:08:16 2013
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jmeter.threads;
+
+import org.apache.jmeter.engine.ConvertListeners;
+import org.apache.jmeter.samplers.Remoteable;
+import org.apache.jmeter.testelement.ThreadListener;
+
+/**
+ * Empty implementation only used to be able to do replacement by {@link ConvertListeners}
+ * @since 2.10
+ */
+public class RemoteThreadsListenerTestElement implements Remoteable, ThreadListener {
+    
+    @Override
+    public void threadStarted() {
+        // NOOP
+    }
+
+    /**
+     *
+     */
+    @Override
+    public void threadFinished() {
+        // NOOP        
+    }
+}

Propchange: jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerTestElement.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerWrapper.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerWrapper.java?rev=1519088&view=auto
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerWrapper.java (added)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerWrapper.java Fri
Aug 30 21:08:16 2013
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jmeter.threads;
+
+import java.io.Serializable;
+import java.rmi.RemoteException;
+
+import org.apache.jmeter.engine.util.NoThreadClone;
+import org.apache.jmeter.testelement.AbstractTestElement;
+import org.apache.jmeter.testelement.ThreadListener;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
+
+/**
+ * server side wrapper, used to notify RMI client 
+ * @since 2.10
+ */
+public class RemoteThreadsListenerWrapper extends AbstractTestElement implements ThreadListener,
Serializable,
+        NoThreadClone {
+    private static final Logger log = LoggingManager.getLoggerForClass();
+
+    private static final long serialVersionUID = 240L;
+
+    private RemoteThreadsListener listener;
+
+    public RemoteThreadsListenerWrapper(RemoteThreadsListener l) {
+        listener = l;
+    }
+
+    public RemoteThreadsListenerWrapper() {
+    }
+
+    @Override
+    public void threadStarted() {
+        try {
+            listener.threadStarted();
+        } catch (RemoteException err) {
+            log.error("", err); // $NON-NLS-1$
+        }
+    }
+
+    @Override
+    public void threadFinished() {
+        try {
+            listener.threadFinished();
+        } catch (RemoteException err) {
+            log.error("", err); // $NON-NLS-1$
+        }
+    }
+}

Propchange: jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerWrapper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1519088&r1=1519087&r2=1519088&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Fri Aug 30 21:08:16 2013
@@ -328,6 +328,7 @@ Previously the default was 1, which coul
 <li><bugzilla>55405</bugzilla> - ant download_jars task fails if lib/api
or lib/doc are missing. Contributed by Antonio Gomes Rodrigues.</li>
 <li><bugzilla>55427</bugzilla> - TestBeanHelper should ignore properties
not supported by GenericTestBeanCustomizer</li>
 <li><bugzilla>55459</bugzilla> - Elements using ComboStringEditor lose
the input value if user selects another Test Element</li>
+<li><bugzilla>54152</bugzilla> - In distributed testing : activeThreads
and totalThreads always show 0</li>
 </ul>
 
 <!-- =================== Improvements =================== -->



Mime
View raw message