一个非常离奇古怪的问题

fainfy fainfy 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

if (isFirstInitialization) {
packetWriter = new PacketWriter(this);
packetReader = new PacketReader(this);

// If debugging is enabled, we should start the thread that will listen for
// all packets and then log them.
if (config.isDebuggerEnabled()) {
addPacketListener(debugger.getReaderListener(), null);
if (debugger.getWriterListener() != null) {
addPacketSendingListener(debugger.getWriterListener(), null);
}
}
}
else {
packetWriter.init();
packetReader.init();
}

// Start the packet writer. This will open a XMPP stream to the server
packetWriter.startup();
// Start the packet reader. The startup() method will block until we
// get an opening stream packet back from server.
packetReader.startup();

// Make note of the fact that we're now connected.
connected = true;

// Start keep alive process (after TLS was negotiated - if available)
packetWriter.startKeepAliveProcess();



Exception in thread "Thread-33" java.lang.NullPointerException
at org.jivesoftware.smack.XMPPConnection.initConnection(XMPPConnection.java:595)
at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:548)
at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:974)
at net.sf.kraken.protocols.xmpp.XMPPSession$1.run(XMPPSession.java:277)
at java.lang.Thread.run(Thread.java:619)


// Start keep alive process (after TLS was negotiated - if available)
packetWriter.startKeepAliveProcess();

在这一行中出现了空指针错误,太古怪了.在这句代码之前,还有很多使用到packetWriter的地方呢,并且该对象是在上面被创建的.
这个问题并不是必现,只是当大并发的时候会出现,不知其原因,想请高手解答.
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
fainfy
Java SE 62,620 成员 307,251 内容