我有一个在main方法中启动的serverSocket程序。之后,我立即启动计时器任务。我注意到计时器线程停止了服务器套接字从主线程执行传入的Socket请求。
public static void main(String[] args)
{
try
{
CreditSystem server=new CreditSystem();
server.startServer();
Thread t=new Thread(new Runnable() {
public void run() {
Timer timer = new Timer();
CheckHandShake st = new CheckHandShake();
timer.schedule(st,0,4000);
}
});
t.start();
}
catch(Exception ex)
{
logger.error("error starting ISO Server");
logger.error(Misc.exceptionStacktraceToString(ex));
}
}