2014-04-22 3 views
2

RMI Cache Replicator 전략을 수행하는 동안 애플리케이션의 캐시 교착 상태 문제가 발생합니다. 내가 ehcache-core ver 2.4.3을 사용하고RMI Cache Replicator를 사용하는 동안 EhCache 교착 상태 문제가 발생했습니다.

<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> 

: RMI 동기화 내으로 Ehcache 구성입니다 다음

net.sf.ehcache.transaction.DeadLockException: deadlock detected in cache [abcCache] on key [1] between current transaction [139003] and foreign transaction [138998] 

at net.sf.ehcache.transaction.local.LocalTransactionStore.put(LocalTransactionStore.java:200) 
at net.sf.ehcache.transaction.local.JtaLocalTransactionStore.put(JtaLocalTransactionStore.java:268) 
at net.sf.ehcache.Cache.putInternal(Cache.java:1434) 
at net.sf.ehcache.Cache.put(Cache.java:1367) 
at net.sf.ehcache.Cache.put(Cache.java:1339) 

: 다음 는 예외 로그입니다. 감사합니다.

답변

1

이 답변은 찾고자하는 답변이 아니지만 RMI 복제 및 트랜잭션 캐시는 함께 지원되지 않습니다. 이제 DeadLock이 RMI 복제가 반드시 필요한 것은 아닙니다. 여기서 다른 트랜잭션 모드를 읽을 수 있습니다 : http://ehcache.org/documentation/apis/transactions 기본적으로 xa_strict 환경 이외의 다른 환경에서 이러한 트랜잭션 모드를 읽을 수 있습니다. 따라서 지불 할 의사가없는 가격이라면 시간 초과되기 전에 모든 거래가 항목에 액세스 할 수 있도록해야합니다 (예 : 시간 초과로 인해 문제가 해결 될 수 있음). xa & 로컬 트랜잭션 캐시는 현재 다른 트랜잭션/스레드에 의해 잠겨 있기 때문에 해당 제한 시간 내에 항목을 "잠글"수없는 경우 예외를 throw합니다. 희망이 의미가 있습니다.