请确认这XMPP代码不是线程安全的
-
06-09-2019 - |
题
我读的源代码到的Smack API和方法XMPPConnection#断开看起来像这样:
public void disconnect(Presence unavailablePresence) {
// If not connected, ignore this request.
if (packetReader == null || packetWriter == null) {
return;
}
shutdown(unavailablePresence);
if (roster != null) {
roster.cleanup();
roster = null;
}
wasAuthenticated = false;
packetWriter.cleanup();
packetWriter = null;
packetReader.cleanup();
packetReader = null;
}
在我的方案,我存储称为会话类中的活XMPPConnection。 执行的单独的线程将尝试通过调用活动#的关机关闭我的XMPPConnection的实例()的。在我看来,我将不得不告诉协作会议通过获取互斥或东西,关闭XMPPConnection。正确的吗?
解决方案
看起来就像是一个已知错误。
不隶属于 StackOverflow