myeclipse web 项目怎么设置过一段时间后项目自动停止。项目框架(struts spring mybaits ) tomcat6.0 求大神指点。。。
System.exit(0);一句话就好了啊,项目启动计时,自己定时执行这句话,服务器就关掉了。
public class Task {
public static void main(String[] args) {
final long timeInterval = 1000;
Runnable runnable = new Runnable() {
public void run() {
while (true) {
try {
Thread.sleep(timeInterval);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.exit(0);
}
}
};
Thread thread = new Thread(runnable);
thread.start();
}
}
自己写一个servlet配置下就可以实现
过一段时间后项目自动停止???这是神马需求? 只听过定时任务 定时执行 。。。。