2016-08-17 211 views
0

我的一個生產中應用的越來越大量的阻止,因爲的阿帕奇BeanUtils的鎖定

Waiting for Monitor Lock on org/apache/commons/beanutils/[email protected] 

BeanUtils的使用WeakHashMap的管理器,並在地圖中的條目的映射線程的垃圾收集器運行時,將被清除。方法WeakFastHashMap.put()中的代碼在這個上同步並且似乎是導致線程阻塞。

at org/apache/commons/beanutils/WeakFastHashMap.put(WeakFastHashMap.java:249(Compiled Code)) 
at org/apache/commons/beanutils/ConvertUtilsBean.register(ConvertUtilsBean.java:873(Compiled Code)) 
at org/apache/commons/beanutils/ConvertUtilsBean.register(ConvertUtilsBean.java:786(Compiled Code)) 
at org/apache/commons/beanutils/ConvertUtilsBean.registerArrayConverter(ConvertUtilsBean.java:781(Compiled Code)) 
at org/apache/commons/beanutils/ConvertUtilsBean.registerArrays(ConvertUtilsBean.java:745(Compiled Code)) 
at org/apache/commons/beanutils/ConvertUtilsBean.register(ConvertUtilsBean.java:605(Compiled Code)) 

這種情況是隨機發生的,並導致高cpu並縮短gc週期之間的時間間隔。什麼是解決這個問題的最好方法。

使用的Beanutils版本是1.8.0。的代碼生成此線是:

BeanUtilsBean.getInstance().getConvertUtils().register(false, false, 0); 

在項目中使用的其他框架是新澤西1.8和彈簧3.1和4.2冬眠。

+0

您能否提供更多信息,例如你使用的是什麼應用程序框架,你如何創建'ConvertUtilsBean',你是否在任何地方存儲你創建的'ConvertUtilsBean'?等 – Brian

+0

添加到問題。 –

回答