像这样调用的EXE执行完后是不是自动结束了线程,我在TOMCAT里调用这个方法时,调用太多出现了线程超出一百五十最大值情况,在JAVA里运行没有问题,怎么做才能使TOMCAT不报这个线程超出的错,是不是我的EXE调用时没有结束线程,应该怎么结束?怎么优化下面的代码
public class kkd extends Thread {
private String llkd="";
public kkd (String oo){
this.llkd=oo;
}
public void run() {
try {
Process cmpp = Runtime.getRuntime().exec("cmd.exe /c start ping 192.168.0.1 ");
} catch (Exception s) {
System.out.println("出错:" + s.toString());
}}
public static void main(String[] args) {
Thread startthread=null;
for (int i=0;i<1000;i++){
startthread =new kkd ("192.168.0.1");
startthread .start();
}
}
}
public class kkd extends Thread {
private String llkd="";
public kkd (String oo){
this.llkd=oo;
}
public void run() {
try {
Process cmpp = Runtime.getRuntime().exec("cmd.exe /c start ping 192.168.0.1 ");
} catch (Exception s) {
System.out.println("出错:" + s.toString());
}}
public static void main(String[] args) {
Thread startthread=null;
for (int i=0;i<1000;i++){
startthread =new kkd ("192.168.0.1");
startthread .start();
}
}
}
严重: All threads (150) are currently busy, waiting. Increase maxThreads (150) or check the servlet status
严重: All threads (150) are currently busy, waiting. Increase maxThreads (150) or check the servlet status
不知道你是在tomcat里怎么调用的,给出的信息不够
port="80" maxThreads="1500" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" />
for(int i=0;in<100000;i++){
Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE http://192.168.0.1/1.asp");
}