protected void stopProcess(String mode) {
		String pidProperty = agentConfig.getAgentPidProperties(mode);

		if (isBlank(pidProperty)) {
			printMessageAndExit(format("Error occurred while terminating %s process. (empty pid)", mode));
		}

		int pid = parseInt(pidProperty);
		OSProcess process = getProcess(pid);
		if (process == null) {
			printMessageAndExit(format("Error occurred while terminating %s process. (pid: %s is not running)", mode, pid));
		}

		killProcess(pid);

		process = getProcess(pid);
		if (process != null) {
			printMessageAndExit(format("Error occurred while terminating %s process.\n"
					+ "It can be already stopped or you may not have the permission.\n"
					+ "If everything is OK. Please stop it manually.", mode));
		}

		agentConfig.updateAgentPidProperties(mode);
	}
Stop process.

@param mode agent or monitor.
ngrinder-core/src/main/java/org/ngrinder/NGrinderAgentStarter.java