You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2018/07/07 13:27:20 UTC

svn commit: r1835311 - in /jmeter/trunk: src/core/org/apache/jmeter/samplers/RemoteSampleListenerImpl.java src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java xdocs/changes.xml xdocs/usermanual/remote-test.xml

Author: fschumacher
Date: Sat Jul  7 13:27:20 2018
New Revision: 1835311

URL: http://svn.apache.org/viewvc?rev=1835311&view=rev
Log:
Fix usage of ports, when client.rmi.localport is set for distributed runs.

This is not a complete fix, as there can be more than one Listener and
they can be initialized more than once. That will lead to exceptions.

Bugzilla Id: 62463

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/samplers/RemoteSampleListenerImpl.java
    jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/remote-test.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/samplers/RemoteSampleListenerImpl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/samplers/RemoteSampleListenerImpl.java?rev=1835311&r1=1835310&r2=1835311&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/samplers/RemoteSampleListenerImpl.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/samplers/RemoteSampleListenerImpl.java Sat Jul  7 13:27:20 2018
@@ -37,8 +37,8 @@ public class RemoteSampleListenerImpl ex
 
     private final SampleListener sampleListener;
     
-    private static final int DEFAULT_LOCAL_PORT = 
-        JMeterUtils.getPropDefault("client.rmi.localport", 0); // $NON-NLS-1$
+    private static final int DEFAULT_LOCAL_PORT = addOffset(
+        JMeterUtils.getPropDefault("client.rmi.localport", 0), 2); // $NON-NLS-1$
 
     public RemoteSampleListenerImpl(Object listener) throws RemoteException {
         super(DEFAULT_LOCAL_PORT, RmiUtils.createClientSocketFactory(),  RmiUtils.createServerSocketFactory());
@@ -54,6 +54,13 @@ public class RemoteSampleListenerImpl ex
         }
     }
 
+    private static int addOffset(int port, int offset) {
+        if (port == 0) {
+            return 0;
+        }
+        return port + offset;
+    }
+
     @Override
     public void testStarted() {
         if (testListener != null) {

Modified: 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=1835311&r1=1835310&r2=1835311&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/RemoteThreadsListenerImpl.java Sat Jul  7 13:27:20 2018
@@ -49,8 +49,8 @@ public class RemoteThreadsListenerImpl e
     /**
      * 
      */
-    private static final int DEFAULT_LOCAL_PORT = 
-            JMeterUtils.getPropDefault("client.rmi.localport", 0); // $NON-NLS-1$
+    private static final int DEFAULT_LOCAL_PORT = addOffset(
+            JMeterUtils.getPropDefault("client.rmi.localport", 0), 1); // $NON-NLS-1$
 
     /**
      * @throws RemoteException if failed to export object
@@ -80,6 +80,13 @@ public class RemoteThreadsListenerImpl e
         }
     }
 
+    private static int addOffset(int port, int offset) {
+        if (port == 0) {
+            return 0;
+        }
+        return port + offset;
+    }
+
     /**
      * 
      * @see RemoteThreadsListener#threadStarted()

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1835311&r1=1835310&r2=1835311&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Jul  7 13:27:20 2018
@@ -241,6 +241,7 @@ this behaviour, set <code>httpclient.res
   <li><bug>62281</bug>Prevent NPE in MapProperty. Patch by belugabehr (dam6923 at gmail.com)</li>
   <li><bug>62457</bug>In usermanual, the UUID Function's example is wrong. Contributed by helppass (onegaicimasu at hotmail.com)</li>
   <li><bug>62478</bug>Escape commata in parameters when constructing function strings in the GUI function helper. Reported by blue414 (blue414 at 163.com)</li>
+  <li><bug>62463</bug>Fix usage of ports, when <code>client.rmi.localport</code> is set for distributed runs.</li>
 </ul>
 
  <!--  =================== Thanks =================== -->

Modified: jmeter/trunk/xdocs/usermanual/remote-test.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/remote-test.xml?rev=1835311&r1=1835310&r2=1835311&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/remote-test.xml (original)
+++ jmeter/trunk/xdocs/usermanual/remote-test.xml Sat Jul  7 13:27:20 2018
@@ -92,10 +92,10 @@ there is no need to start RMI registry s
 To revert to the previous behaviour, define the JMeter property <source>server.rmi.create=false</source> on the server host systems.
 </p>
 <p>
-By default, RMI uses a dynamic port for the JMeter server engine. This can cause problems for firewalls,
+By default, RMI uses dynamic ports for the JMeter server engine. This can cause problems for firewalls,
 so you can define the JMeter property <code>server.rmi.localport</code> 
-to control this port number.
-If this is non-zero, it will be used as the local port number for the server engine.
+to control this port numbers.
+If this is non-zero, it will be used as the base for local port numbers for the server engine. At the moment JMeter will open up to three ports beginning with the port defined in <code>server.rmi.localport</code>.
 </p>
 <p><b>Step 2: Add the server IP to your client's Properties File</b></p>
 <p>Edit the properties file <i>on the controlling JMeter machine</i>.  In <code>JMETER_HOME/bin/jmeter.properties</code>,