BatchInspectionOperation.jsp
2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<%@ include file="/templetecheck/filecheck/CheckUserIsSysadmin.jsp" %>
<%@ page import="weaver.templetecheck.filecheck.CheckRule" %>
<%@ page import="weaver.general.GCONST" %>
<%@ page import="java.io.File" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.templetecheck.filecheck.DoCheckAllPartThread" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.Set" %>
<%@ page import="org.json.JSONObject" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
String operation= Util.null2String(request.getParameter("operation"));
if("startcheckrule".equals(operation)){//开始检测规则
try{
if(DoCheckAllPartThread.runstatus==0){
if(CheckRule.isrunpartStatus!=0){
CheckRule.isrunpartStatus=0;
}
DoCheckAllPartThread doCheckAllPartThread=new DoCheckAllPartThread();
Thread thread=new Thread(doCheckAllPartThread);
thread.setName("executeCheckRule");
thread.start();
}else{
new BaseBean().writeLog("文件正在检测");
}
}catch(Exception e){
new BaseBean().writeLog("文件检测错误");
}
}else if("stopcheckrule".equals(operation)){
new BaseBean().writeLog("start to kill thread 开始杀死进程");
try{
if(DoCheckAllPartThread.runstatus==1){
Set<Thread> runningThreads=Thread.getAllStackTraces().keySet();
for(Thread runningThread:runningThreads){
if(runningThread.getName().equals("executeCheckRule")){
runningThread.stop();//关闭线程
DoCheckAllPartThread.runstatus=0;
break;
}
}
}else{
new BaseBean().writeLog("文件检测程序未运行");
}
}catch(Exception e){
new BaseBean().writeLog("error to kill thread errormessage:"+e.toString());
}
new BaseBean().writeLog("end to kill thread 结束进程");
}else if("getexecuteinfo".equals(operation)){
JSONObject json=new JSONObject();
if(DoCheckAllPartThread.runstatus==1){
json.put("step",CheckRule.isrunpartStatus);
}else{
if(CheckRule.isrunpartStatus==6){
json.put("step","6");
}else{
json.put("step","0");
}
}
response.getWriter().print(json.toString());
}
%>