jakarta-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1067248 - /jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java
Date Fri, 04 Feb 2011 18:11:03 GMT
Author: sebb
Date: Fri Feb  4 18:11:03 2011
New Revision: 1067248

URL: http://svn.apache.org/viewvc?rev=1067248&view=rev
Log:
Close window

Modified:
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java?rev=1067248&r1=1067247&r2=1067248&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java Fri
Feb  4 18:11:03 2011
@@ -57,10 +57,13 @@ public class RemoteJMeterEngineImpl exte
             System.out.println("Using local port: "+DEFAULT_LOCAL_PORT);
         }
     }
+
     // Should we create our own copy of the RMI registry?
     private static final boolean createServer =
         JMeterUtils.getPropDefault("server.rmi.create", true); // $NON-NLS-1$
 
+    private final Object LOCK = new Object();
+
     private RemoteJMeterEngineImpl(int port) throws RemoteException {
         super(port); // Create this object using the specified port (0 means anonymous)
         System.out.println("Created remote object: "+this.getRef().remoteToString());
@@ -122,13 +125,15 @@ public class RemoteJMeterEngineImpl exte
      */
     public void configure(HashTree testTree, String host, File jmxBase) throws RemoteException
{
         log.info("Creating JMeter engine on host "+host+" base '"+jmxBase+"'");
-        if (backingEngine != null && backingEngine.isActive()) {
-            log.warn("Engine is busy - cannot create JMeter engine");
-            throw new IllegalStateException("Engine is busy - please try later");
-        }
-        ownerThread = Thread.currentThread();
-        backingEngine = new StandardJMeterEngine(host);
-        backingEngine.configure(testTree);
+        synchronized(LOCK) { // close window where another remote client might jump in
+            if (backingEngine != null && backingEngine.isActive()) {
+                log.warn("Engine is busy - cannot create JMeter engine");
+                throw new IllegalStateException("Engine is busy - please try later");
+            }
+            ownerThread = Thread.currentThread();
+            backingEngine = new StandardJMeterEngine(host);
+            backingEngine.configure(testTree); // sets active = true
+        }
         FileServer.getFileServer().setBase(jmxBase);
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org


Mime
View raw message