JobResult senderResult = results[j]; long timeOfFirstSend = senderResult.initTime;
JobResult senderResult = results[j * 2]; JobResult receiverResult = results[j * 2 + 1]; long timeOfFirstSend = senderResult.startTime;
   public void testQueueScale2()   {      log.info("Running test testQueueScale2");                   Execution execution = createExecution("QueueScale2");            for (int i = 1; i <= scaleNumber; i++)      {         log.trace("Running with " + i + " connection(s)");                //Create the jobs                  Job[] jobs = new Job[i + 1];                  for (int j = 0; j < i; j++)         {                     SenderJob sender = createDefaultSenderJob(this.queueName);            jobs[j] = sender;            sender.setNumMessages(numMessages);            sender.setMf(new BytesMessageMessageFactory());            sender.setTransacted(false);            sender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);            sender.setSlaveURL(slaveURLs[j % this.numSlaves]);                              }                  //and one receiver         ReceiverJob receiver = createDefaultReceiverJob(this.queueName);         jobs[i] = receiver;                  receiver.setAckMode(Session.AUTO_ACKNOWLEDGE);         receiver.setTransacted(false);         receiver.setNumMessages(numMessages * i);         receiver.setSlaveURL(slaveURLs[i % this.numSlaves]);                  JobResult[] results = runJobs(jobs);                  if (!checkResults(results, "QueueScale2"))         {            return;         }                  /*          * NB.          * When we calculating the total time taken from first send to last receive, there is some          * error involved due to the differences in network latency and other remoting overhead          * when sending the jobs to be executed on potentially different remote machines.          * We make the assumption that this this difference is very small compared with time taken          * to run the tests as to be negligible.          */                  long minTimeOfFirstSend = Long.MAX_VALUE;         long maxTimeOfLastReceive = results[i].testTime + results[i].initTime;         for (int j = 0; j < i; j++)         {            JobResult senderResult = results[j];            long timeOfFirstSend = senderResult.initTime;            minTimeOfFirstSend = Math.min(minTimeOfFirstSend, timeOfFirstSend);         }                  long totalTimeTaken = maxTimeOfLastReceive - minTimeOfFirstSend;         long totalMessagesSent = i * numMessages;                  Measurement measure = new Measurement("throughput", 1000 * ((double)totalMessagesSent) / totalTimeTaken);         measure.setVariableValue("numberOfConnections", i);         execution.addMeasurement(measure);      }            pm.saveExecution(execution);            log.info("Test testQueueScale2 finished");         }