package org.bench4q.monitor.api;

import java.util.Timer;

import org.bench4q.monitor.service.TimerService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/monitor")
public class StartToRecord {
	private Timer timer = new Timer();

	@RequestMapping("/start")
	@ResponseBody
	public String start() {
		timer.schedule(new TimerService(), 1000, 2000);
		return new String("startted");
	}

	@RequestMapping("/stop")
	@ResponseBody
	public String stop() {
		timer.cancel();
		return new String("stopped");

	}
}
