/**
  * Adds a feature to the ThreadGroup attribute of the RemoteJMeterEngineImpl object.
  *
  * @param testTree the feature to be added to the ThreadGroup attribute
  */
 @Override
 public void rconfigure(HashTree testTree, String host, File jmxBase, String scriptName)
     throws RemoteException {
   log.info("Creating JMeter engine on host " + host + " base '" + jmxBase + "'");
   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().setScriptName(scriptName);
   FileServer.getFileServer().setBase(jmxBase);
 }
 @Override
 public void rstopTest(boolean now) throws RemoteException {
   if (now) {
     log.info("Stopping test ...");
   } else {
     log.info("Shutting test ...");
   }
   backingEngine.stopTest(now);
   log.info("... stopped");
 }
 @Override
 public void rreset() throws RemoteException, IllegalStateException {
   // Mail on userlist reported NPE here - looks like only happens if there are network errors, but
   // check anyway
   if (backingEngine != null) {
     log.info("Reset");
     checkOwner("reset");
     backingEngine.reset();
   } else {
     log.warn("Backing engine is null, ignoring reset");
   }
 }
 @Override
 public void rsetProperties(Properties p) throws RemoteException, IllegalStateException {
   checkOwner("setProperties");
   if (remotelySetProperties != null) {
     Properties jmeterProperties = JMeterUtils.getJMeterProperties();
     log.info("Cleaning previously set properties " + remotelySetProperties);
     for (Iterator<?> iterator = remotelySetProperties.keySet().iterator(); iterator.hasNext(); ) {
       String key = (String) iterator.next();
       jmeterProperties.remove(key);
     }
   }
   backingEngine.setProperties(p);
   this.remotelySetProperties = p;
 }
 /*
  * Called by:
  * - ClientJMeterEngine.exe() which is called on remoteStop
  */
 @Override
 public void rexit() throws RemoteException {
   log.info("Exitting");
   backingEngine.exit();
   // Tidy up any objects we created
   Registry reg = LocateRegistry.getRegistry(this.rmiPort);
   try {
     reg.unbind(JMETER_ENGINE_RMI_NAME);
   } catch (NotBoundException e) {
     log.warn(JMETER_ENGINE_RMI_NAME + " is not bound", e);
   }
   log.info("Unbound from registry");
   // Help with garbage control
   JMeterUtils.helpGC();
 }
 @Override
 public void rrunTest() throws RemoteException, JMeterEngineException, IllegalStateException {
   log.info("Running test");
   checkOwner("runTest");
   backingEngine.runTest();
 }