经常碰到运营部门人要清缓存而缓存一直存在问题老在电脑面前处理也不是个办法想了个方法通过访问一个jsp页面自动清缓存
<%@ page language="java" import="javaio*" pageEncoding="UTF"%>
<%
String path = requestgetContextPath();
String basePath = requestgetScheme() + "://"
+ requestgetServerName() + ":" + requestgetServerPort()
+ path + "/";
%>
<html>
<head>
<title>shell</title>
</head>
<body>
<%
String cmds = "monitorsh";
try {
Process process;
process = RuntimegetRuntime()exec("sh /opt/wzx/monitorsh");
InputStreamReader ir = new InputStreamReader(process
getInputStream());
LineNumberReader input = new LineNumberReader(ir);
String line;
processwaitFor();
while ((line = inputreadLine()) != null){
outprint(line);
outprint("<br/>");
}
if(input!=null){
inputclose();
} catch (Exception e) {
eprintStackTrace();
%>
</body>
</html>
testsh 脚本内容
echo flush_all | nc
将该脚本放到jboss/server/default/deploy/jbosswebdeployer/ROOTwar/ 下就可以访问了