Many thanks for the reply.
I have been trying to debug this for a few days now, and the app/server becomes really messed up when this happens.
It is only happening when the cache expires and 2 or more threads hit the server at the same time.
It seems to be trying to do a get and a put into the cache from both threads, and somehow it gets deadlocked. Things go very funny after that.
I tried adding a BlockingCache as a decorator, and verified it registered, by debugging, but the same thing happened.
I have 60 seconds as timeToLiveSeconds so it expires quicker and I can replicate the deadlock
If you want more thread dumps or anything let me know.
jvisualvm is able to catch the deadlock when I run 5 users against the server. So I can replicate the issue fairly easy. Maybe its time to try and write a unit test to replicate the issue, and see if I can get some better help.
I am currently at a loss as what to do, I though ehcache would be able to handle concurrency pretty well, but at the moment, I think I may try another provider.......
eg.
<cache name="branch" maxEntriesLocalHeap="10000" eternal="false" timeToLiveSeconds="60" transactionalMode="xa">
<cacheDecoratorFactory class="com.ardan1.core.ehcache.BlockingCacheDecoratorFactory"/>
<persistence strategy="none" />
</cache>
public class BlockingCacheDecoratorFactory extends CacheDecoratorFactory {
@Override
public Ehcache createDecoratedEhcache(Ehcache cache, Properties properties) {
return new BlockingCache(cache);
}
@Override
public Ehcache createDefaultDecoratedEhcache(Ehcache cache, Properties properties) {
return new BlockingCache(cache);
}
}