HardCacheWeakIdentityMap无法获取读锁定

时间:2015-09-07 16:05:50

标签: java multithreading osgi eclipselink

我们有一个OSGi(Java)应用程序,我们使用eclipseLink与mssql数据库进行交互。

偶尔会出现系统陷入僵局的情况。当我暂停并检查所有线程时,我发现一个线程导致了问题。

Name: pool-40-thread-1
State: WAITING on org.eclipse.persistence.internal.identitymaps.HardCacheWeakIdentityMap$ReferenceCacheKey@24c6f90c
Total blocked: 2  Total waited: 22

Stack trace: 
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Unknown Source)
org.eclipse.persistence.internal.helper.ConcurrencyManager.acquireReadLock(ConcurrencyManager.java:236)
org.eclipse.persistence.internal.identitymaps.CacheKey.acquireReadLock(CacheKey.java:277)
org.eclipse.persistence.internal.helper.ConcurrencyManager.checkReadLock(ConcurrencyManager.java:224)
org.eclipse.persistence.internal.identitymaps.CacheKey.checkReadLock(CacheKey.java:255)
org.eclipse.persistence.internal.identitymaps.IdentityMapManager.getFromIdentityMap(IdentityMapManager.java:805)
org.eclipse.persistence.internal.sessions.IdentityMapAccessor.getFromLocalIdentityMap(IdentityMapAccessor.java:437)
org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.checkCacheForObject(ExpressionQueryMechanism.java:857)
org.eclipse.persistence.queries.ReadObjectQuery.checkEarlyReturnLocal(ReadObjectQuery.java:246)
org.eclipse.persistence.queries.ObjectLevelReadQuery.checkEarlyReturn(ObjectLevelReadQuery.java:846)
org.eclipse.persistence.queries.ObjectLevelReadQuery.checkEarlyReturn(ObjectLevelReadQuery.java:872)
org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:836)
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1127)
org.eclipse.persistence.queries.ReadObjectQuery.execute(ReadObjectQuery.java:431)
org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1215)
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896)
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804)
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1786)
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1737)
org.eclipse.persistence.internal.jpa.EntityManagerImpl.executeQuery(EntityManagerImpl.java:900)
org.eclipse.persistence.internal.jpa.EntityManagerImpl.findInternal(EntityManagerImpl.java:843)
org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:719)
org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:588)
org.amdatu.jpa.extender.DelegatingEntityManager.find(DelegatingEntityManager.java:165)
   - locked org.amdatu.jpa.extender.DelegatingEntityManager@1e32127e
com.bekaert.handling.unit.spool.ws.location.ana.WsAnaLocationService.findUnitLocation(WsAnaLocationService.java:161)
com.bekaert.handling.unit.spool.ws.location.ana.WsAnaLocationService.findUnitLocation(WsAnaLocationService.java:1)
sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.amdatu.jta.manager.TransactionalAspect.invoke(TransactionalAspect.java:123)
com.sun.proxy.$Proxy46.findUnitLocation(Unknown Source)
com.bekaert.handling.opc.trigger.ana.position.AnaPositionUpdateListener.updateUnits(AnaPositionUpdateListener.java:105)
com.bekaert.handling.opc.trigger.ana.position.AnaPositionUpdateListener.opcItemDataChanged(AnaPositionUpdateListener.java:68)
com.bekaert.opc.da.OpcDataChangeListeners$Listener$1.run(OpcDataChangeListeners.java:201)
java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
java.util.concurrent.FutureTask.run(Unknown Source)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)

似乎这个线程正在等待acquireReadLock。但我找不到任何已经锁定的其他线程。

如果我在eclipse中检查堆栈,

  

等待:HardCacheWeakIdentityMap $ ReferenceCacheKey(id = 3019)

不是“拥有”任何东西。

好像这个identityMap等着什么? 或者我在这里想念一些东西?我可以查一下其他的东西吗?

提前致谢!

0 个答案:

没有答案