<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.control.*" %>
<%@ page import="java.io.IOException" %>
<%@ include file="/sessionInfo.jsp"%>
<%
//获取操作类型：1、启动 2、关闭 3、重启
String open = SzConvert.toZeroStr(request.getParameter("open"));

ControlTimer ct = ControlTimer.getControlTimer();

String wait_time = SzConvert.toZeroStr(request.getParameter("wait_time"));
String Max_response_time = SzConvert.toZeroStr(request.getParameter("Max_response_time"));
String max_overtime_times = SzConvert.toZeroStr(request.getParameter("max_overtime_times"));
String port = SzConvert.toZeroStr(request.getParameter("port"));
String check_cycle = SzConvert.toZeroStr(request.getParameter("check_cycle"));
String spaceName = SzConvert.strWriteData(request.getParameter("spaceName"));

if(!wait_time.equals("0")&&!Max_response_time.equals("0")&&!max_overtime_times.equals("0")&&!check_cycle.equals("0")){
	ct.setWait_time(Long.valueOf(wait_time));
	ct.setMax_response_time(Integer.valueOf(Max_response_time));
	ct.setCheck_cycle(Integer.valueOf(check_cycle));
	ct.setMax_overtime_times(Integer.valueOf(max_overtime_times));
	ct.setPort(Integer.valueOf(port));
	ct.setSpaceName(spaceName);
	ct.writerInfo();
}
if(open.equals("2")||open.equals("3")){
	try {
		Runtime.getRuntime().exec(ct.getShutdownTomcat());
		Thread.currentThread().sleep(1*1000);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (InterruptedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
if(open.equals("1")||open.equals("3")){
	try {
		Runtime.getRuntime().exec(ct.getStartupTomcat());
		Thread.currentThread().sleep(1*1000);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (InterruptedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}

response.sendRedirect("controlManager.jsp");
%>

