java - EhCache Deadlock issue while using RMI Cache Replicator -


i facing cache deadlock issue in application while rmi cache replicator strategy. following exception log:

net.sf.ehcache.transaction.deadlockexception: deadlock detected in cache [abccache] on key [1] between current transaction [139003] , foreign transaction [138998]  @ net.sf.ehcache.transaction.local.localtransactionstore.put(localtransactionstore.java:200) @ net.sf.ehcache.transaction.local.jtalocaltransactionstore.put(jtalocaltransactionstore.java:268) @ net.sf.ehcache.cache.putinternal(cache.java:1434) @ net.sf.ehcache.cache.put(cache.java:1367) @ net.sf.ehcache.cache.put(cache.java:1339) 

following ehcache configuration rmi synchronization:

<transactionmanagerlookup     class="net.sf.ehcache.transaction.manager.defaulttransactionmanagerlookup"     properties="jndiname=java:comp/usertransaction" propertyseparator=";"/>  <cachemanagerpeerproviderfactory      class="net.sf.ehcache.distribution.rmicachemanagerpeerproviderfactory"      properties="peerdiscovery=automatic, multicastgroupaddress=x.x.x.x, multicastgroupport=xxxx, timetolive=32"/>                                      <cachemanagerpeerlistenerfactory     class="net.sf.ehcache.distribution.rmicachemanagerpeerlistenerfactory"     properties="port=40001, sockettimeoutmillis=2000"/>  <cache      name="abccache"      maxelementsinmemory="100"     eternal="false"     overflowtodisk="false"      diskpersistent="false"     timetoidleseconds="0"      timetoliveseconds="86400"     memorystoreevictionpolicy="lru"      transactionalmode="xa">     <cacheeventlistenerfactory          class="net.sf.ehcache.distribution.rmicachereplicatorfactory"         properties="replicateputs=true, replicateupdates=true, replicateremovals=true, replicateupdatesviacopy=false, replicateasynchronously=true, asynchronousreplicationintervalmillis=500"/> </cache> 

i using ehcache-core ver 2.4.3. appreciate help.

this might not answer looking for, rmi replication , transactional caches aren't supported together. now, reason deadlock isn't rmi replication though. can read on different transactional modes here: http://ehcache.org/documentation/apis/transactions basically, other in xa_strict environment, might these. if that's price you're not willing pay, need make sure transactions manage access entry prior timing out (i.e. having long time out solve problem). xa & local transaction caches throw exception if can't "lock" entry within timeout period, because it's locked transaction/thread. hope makes sense.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -