/**
* {@inheritDoc}
*/
public SampleResult sample(Entry e) {
JMeterContext context = JMeterContextService.getContext();
int target = getTarget();
int action = getAction();
if (action == PAUSE) {
pause(getDurationAsString());
} else if (action == STOP || action == STOP_NOW || action == RESTART_NEXT_LOOP) {
if (target == THREAD) {
if(action == STOP || action == STOP_NOW) {
log.info("Stopping current thread");
context.getThread().stop();
} else {
log.info("Restarting next loop");
context.setRestartNextLoop(true);
}
// //Not yet implemented
// } else if (target==THREAD_GROUP) {
} else if (target == TEST) {
if (action == STOP_NOW) {
log.info("Stopping all threads now");
context.getEngine().stopTest();
} else {
log.info("Stopping all threads");
context.getEngine().askThreadsToStop();
}
}
}
return null; // This means no sample is saved