我想在Servlet中,根据request参数做为线程的名字来创建线程,如下:...
public void doPost(...){
...
String threadId = request.getParameter("threadid");
TestThread tt = new TestThread(threadId);
...
}
TestThread类
public class TestThread extends Thread{
...
public TestThread(String threadId){
this.setName(threadId);
this.start();
}
...
}
我这样写对吗?
现在我想根据创建线程时的名字threadId来管理线程,该如何做呢?