我有一个jstack转储,似乎说几个线程已经获得了对同一个对象的锁定.据我所知,这是不可能的,但是不是吗?
这是在try块中进行关键等待调用的代码:
protected boolean waitMaxWaitingTime(UserInfo aUserInfo) throws EventServiceException {
final int theMaxWaitingTime = myConfiguration.getMaxWaitingTime();
if(theMaxWaitingTime <= 0) {
return true;
}
if(aUserInfo.isEventsEmpty()) {
//monitor for event notification and double checked
synchronized(aUserInfo) {
if(aUserInfo.isEventsEmpty()) {
try {
final long theStartTime = System.currentTimeMillis();
// --- THE CRUCIAL WAIT CALL ---
aUserInfo.wait(theMaxWaitingTime);
return (System.currentTimeMillis() - theStartTime >= theMaxWaitingTime);
} catch(InterruptedException e) {
throw new EventServiceException("Error on waiting max. waiting time!", e);
}
}
}
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
这是jstack转储(有选择地):
"thread-79" #161 daemon prio=5 …Run Code Online (Sandbox Code Playgroud) 从大型C++软件设计(Lakos),第652页:
问题是,"编译器在哪个唯一的翻译单元中存放给定类的虚拟表定义?".CFRONT(以及许多其他C++实现)采用的技巧是将外部虚拟表放置在翻译单元中,该单元定义类中出现的词法上第一个非内联函数(如果存在).
最常用的编译器(GCC和Visual C++)仍然是这种情况吗?还是曾经?