@Override public long delay() { double nextEvent; EventProducer events = getEventProducer(); synchronized (events) { nextEvent = events.next(); } long delay = (long) (nextEvent * TimeUnit.SECONDS.toMillis(1) + testStarted - System.currentTimeMillis()); if (log.isDebugEnabled()) { log.debug("Calculated delay is {}", delay); } delay = Math.max(0, delay); long endTime = getThreadContext().getThread().getEndTime(); if (endTime > 0 && System.currentTimeMillis() + delay > endTime) { throw new JMeterStopThreadException("The thread is scheduled to stop in " + (System.currentTimeMillis() - endTime) + " ms" + " and the throughput timer generates a delay of " + delay + "." + " JMeter (as of 4.0) does not support interrupting of sleeping threads, thus terminating the thread manually." ); } return delay; }
} catch (JMeterStopThreadException e) { // NOSONAR if (log.isInfoEnabled()) { log.info("Stopping Thread: {}", e.toString());
} catch (JMeterStopThreadException e) { // NOSONAR if (log.isInfoEnabled()) { log.info("Stop Thread seen for thread {}, reason: {}", getThreadName(), e.toString());
throw new JMeterStopThreadException("End of sequence"); String tn = Thread.currentThread().getName(); log.info(tn + " Detected end of sequence."); throw new JMeterStopThreadException("End of sequence");
@Override public void iterationStart(LoopIterationEvent loopIterationEvent) { boolean isIndependentListPerThread = getIndependentListPerThread(); if (!isIndependentListPerThread && directoryListingIterator == null) { throw new JMeterStopThreadException("All files in the directory have been passed."); } if (getIterator().hasNext()) { JMeterVariables variables = JMeterContextService.getContext().getVariables(); variables.put( getStringOrDefault(getDestinationVariableName(), DEFAULT_DESTINATION_VARIABLE_NAME), getFilePath(getIterator().next()) ); } else { // TODO: interrupt iteration directoryListingIterator = null; throw new JMeterStopThreadException("All files in the directory have been passed."); } }
@Override public void iterationStart(LoopIterationEvent event) { Jedis connection = null; try { connection = pool.getResource(); // Get data from list's head String line = getDataFromConnection(connection, redisKey); if(line == null) { // i.e. no more data (nil) throw new JMeterStopThreadException("End of redis data detected"); } if (getRecycleDataOnUse()) { addDataToConnection(connection, redisKey, line); } final String names = variableNames; if (vars == null) { vars = JOrphanUtils.split(names, ","); } final JMeterContext context = getThreadContext(); JMeterVariables threadVars = context.getVariables(); String[] values = JOrphanUtils.split(line, delimiter, false); for (int a = 0; a < vars.length && a < values.length; a++) { threadVars.put(vars[a], values[a]); } } finally { pool.returnResource(connection); } }
throw new JMeterStopThreadException("End of file:"+ getFilename()+" detected for CSV DataSet:" +getName()+" configured with stopThread:"+ getStopThread()+", recycle:" + getRecycle());
@Override public void iterationStart(LoopIterationEvent event) { Jedis connection = null; try { connection = pool.getResource(); String line = null; if(getMode.equals(GetMode.RANDOM_REMOVE)) { line = connection.lpop(redisKey); } else { line = connection.srandmember(redisKey); } if(line == null) { // i.e. no more data (nil) throw new JMeterStopThreadException("End of redis data detected, thread will exit"); } final String names = variableNames; if (vars == null) { vars = JOrphanUtils.split(names, ","); } final JMeterContext context = getThreadContext(); JMeterVariables threadVars = context.getVariables(); String[] values = JOrphanUtils.split(line, delimiter, false); for (int a = 0; a < vars.length && a < values.length; a++) { threadVars.put(vars[a], values[a]); } } finally { pool.returnResource(connection); } }