그러나 new'ed가되는 모든 곳의 'roster'객체에서 동기화됩니다. 어째서?java.lang.IllegalMonitorStateException : wait() 전에 스레드에 의해 객체가 잠기지 않았습니다.
기분을 상하게하는 코드 : "new'ed됩니다"와
public Roster getRoster() {
if (roster == null) {
return null;
}
if (!roster.rosterInitialized) {
try {
synchronized (roster) {
roster.reload();
long waitTime = SmackConfiguration.getPacketReplyTimeout();
long start = System.currentTimeMillis();
while (!roster.rosterInitialized) {
if (waitTime <= 0) {
break;
}
roster.wait(waitTime);
long now = System.currentTimeMillis();
waitTime -= now - start;
start = now;
}
}
}
catch (InterruptedException ie) {
// Ignore.
}
}
return roster;
}
reload()는 무엇을합니까? – Affe
어디서이 관찰에 바로 당신이 – Ronnie