有谁知道为什么线程没有立即启动?也就是说,10 分钟,20 .. 线程不启动... logger 是 java Logger 的简单装饰器...
这是代码开始:
....
log.info("client streams prepared");
messagelistener = new Thread(new Listener(input, this));
messagelistener.start();
log.info("Connection prepared");
....
并开始监听
public class Listener implements Runnable {
private final MyLogger logger = MyLogger.getLogger();
private final ObjectInputStream input;
private final Connection connection;
public Listener(ObjectInputStream input, Connection callback) {
connection = callback;
this.input = input;
logger.info("Listener created");
}
@Override
public void run() {
logger.info("listener thread in connection with "+ connection.getUser().getDisplayName() + " is started");
//.....samecode
logger.info("listener thread in connection with "
+ connection.getUser().getDisplayName() + " is stopped");
}
}
日志:
2013-07-29 22:36:58 MyLogger info INFO: client streams prepared
2013-07-29 22:36:58 MyLogger info INFO: Listener created
2013-07-29 22:36:58 MyLogger info INFO: Connection prepared
in print see info before start, and after start, but not the first line of the method run,从启动到现在已经10多分钟了,系统没有加载,我不明白为什么它不起作用?有人能够向我解释我做错了什么?