in src/core/src/main/java/org/apache/jmeter/threads/JMeterThread.java [553:620]
private void executeSamplePackage(Sampler current,
TransactionSampler transactionSampler,
SamplePackage transactionPack,
JMeterContext threadContext) {
threadContext.setCurrentSampler(current);
// Get the sampler ready to sample
SamplePackage pack = compiler.configureSampler(current);
runPreProcessors(pack.getPreProcessors());
// Hack: save the package for any transaction controllers
threadVars.putObject(PACKAGE_OBJECT, pack);
delay(pack.getTimers());
SampleResult result = null;
if (running) {
Sampler sampler = pack.getSampler();
result = doSampling(threadContext, sampler);
}
// If we got any results, then perform processing on the result
if (result != null) {
if (!result.isIgnore()) {
int nbActiveThreadsInThreadGroup = threadGroup.getNumberOfThreads();
int nbTotalActiveThreads = JMeterContextService.getNumberOfThreads();
fillThreadInformation(result, nbActiveThreadsInThreadGroup, nbTotalActiveThreads);
SampleResult[] subResults = result.getSubResults();
if (subResults != null) {
for (SampleResult subResult : subResults) {
fillThreadInformation(subResult, nbActiveThreadsInThreadGroup, nbTotalActiveThreads);
}
}
threadContext.setPreviousResult(result);
runPostProcessors(pack.getPostProcessors());
checkAssertions(pack.getAssertions(), result, threadContext);
// PostProcessors can call setIgnore, so reevaluate here
if (!result.isIgnore()) {
// Do not send subsamples to listeners which receive the transaction sample
List<SampleListener> sampleListeners = getSampleListeners(pack, transactionPack, transactionSampler);
notifyListeners(sampleListeners, result);
}
compiler.done(pack);
// Add the result as subsample of transaction if we are in a transaction
if (transactionSampler != null && !result.isIgnore()) {
transactionSampler.addSubSamplerResult(result);
}
} else {
// This call is done by checkAssertions() , as we don't call it
// for isIgnore, we explictely call it here
setLastSampleOk(threadContext.getVariables(), result.isSuccessful());
compiler.done(pack);
}
// Check if thread or test should be stopped
if (result.isStopThread() || (!result.isSuccessful() && onErrorStopThread)) {
stopThread();
}
if (result.isStopTest() || (!result.isSuccessful() && onErrorStopTest)) {
shutdownTest();
}
if (result.isStopTestNow() || (!result.isSuccessful() && onErrorStopTestNow)) {
stopTestNow();
}
if (result.getTestLogicalAction() != TestLogicalAction.CONTINUE) {
threadContext.setTestLogicalAction(result.getTestLogicalAction());
}
} else {
compiler.done(pack); // Finish up
}
}