public void doTerminate(PerfTest perfTest, SingleConsole singleConsoleInUse, String errorMessage) {
		if (singleConsoleInUse != null) {
			singleConsoleInUse.unregisterSampling();
			LOG.info(format(perfTest, "Sampling is stopped"));
		}
		String progressMessage = "Stopped by error";

		if (!errorMessage.isEmpty()) {
			progressMessage += "\n" + errorMessage;
		}

		try {
			perfTestService.markProgressAndStatusAndFinishTimeAndStatistics(perfTest,
				Status.STOP_BY_ERROR, progressMessage);
		} catch (Exception e) {
			LOG.error(format(perfTest, "Error while terminating : {}", e.getMessage()));
			LOG.debug(format(perfTest, "Details : "), e);
		}
		consoleManager.returnBackConsole(perfTest.getTestIdentifier(), singleConsoleInUse);
	}
Terminate the given {@link PerfTest}.

@param perfTest           {@link PerfTest} to be finished
@param singleConsoleInUse {@link SingleConsole} which is being used for the given
                          {@link PerfTest}
@param errorMessage       error message
ngrinder-controller/src/main/java/org/ngrinder/perftest/service/PerfTestRunnable.java