2016-08-17 212 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

添加到问题。 –

回答