我有基于Java EE的应用程序在tomcat上运行,我看到突然间应用程序在运行几个小时后挂起。分析java进程的线程转储
我收集了它挂起之前应用程序的线程转储,并把它放在TDA分析:
TDA(线程转储分析器)给出了上述监视器以下消息:
A lot of threads are waiting for this monitor to become available again.
This might indicate a congestion. You also should analyze other locks
blocked by threads waiting for this monitor as there might be much more
threads waiting for it.
这里是上文所强调的线程的堆栈跟踪:
"MY_THREAD" prio=10 tid=0x00007f97f1918800 nid=0x776a
waiting for monitor entry [0x00007f9819560000]
java.lang.Thread.State: BLOCKED (on object monitor)
at java.util.Hashtable.get(Hashtable.java:356)
- locked <0x0000000680038b68> (a java.util.Properties)
at java.util.Properties.getProperty(Properties.java:951)
at java.lang.System.getProperty(System.java:709)
at com.MyClass.myMethod(MyClass.java:344)
我想知道"waiting for monitor entry"
的状态是什么意思?也将不胜感激任何指针来帮助我调试此问题。
我死锁会缓存查找系统属性,而不是像这样重复地调用它们。在应用程序的整个生命周期中,您不需要调用System.getProperty()超过十几次。即你应该编码它,因为它不是瓶颈。 – 2012-07-05 16:06:31
嗯..好点的彼得! – peakit 2012-07-05 16:13:47