[infinispan-issues] [JBoss JIRA] (ISPN-5854) NonTxInvalidationInterceptor added twice to cache used for Hibernate 2LC
Radim Vansa (JIRA)
issues at jboss.org
Fri Nov 13 10:45:02 EST 2015
[ https://issues.jboss.org/browse/ISPN-5854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13128830#comment-13128830 ]
Radim Vansa commented on ISPN-5854:
-----------------------------------
Yes, this is something that was changed in 5.0. Using another instance as key to cache is superfluous if you do not use multi-tenancy, and do not share the region. To be precise, you should have separate cache region per entity hierarchy, not per class. The reason for this was reducing heap memory usage and allocation rate.
There may be some performance advantage sharing regions with transactional caches, but now you should use non-transactional cache configuration. Actually it does not matter if you use transactional or read-write concurrency strategy, what matters is you cache configuration. But it will always work somehow, the difference is only in perf.
Yep, documentation lags a bit...
> NonTxInvalidationInterceptor added twice to cache used for Hibernate 2LC
> ------------------------------------------------------------------------
>
> Key: ISPN-5854
> URL: https://issues.jboss.org/browse/ISPN-5854
> Project: Infinispan
> Issue Type: Bug
> Components: Integration
> Affects Versions: 7.2.5.Final
> Reporter: Karl von Randow
> Assignee: Galder Zamarreño
>
> I use the same Infinispan cache for multiple Hibernate entities. The {{PutFromLoadValidator}} looks for and replaces the {{InvalidationInterceptor}} the first time it sees the cache, but the second time it fails to find the {{InvalidationInterceptor}} and ends up with {{invalidationPosition = 0}} from line 168, which means it incorrectly removes the first interceptor from the chain and then tries to add the {{NonTxInvalidationInterceptor}} again, causing the exception below.
> Perhaps the {{NonTxInvalidationInterceptor}} should only be added once per cache, or the {{accessStrategy}} should be cached or something?
> {noformat}
> org.infinispan.commons.CacheConfigurationException: Detected interceptor of type [org.hibernate.cache.infinispan.access.NonTxInvalidationInterceptor] being added to the interceptor chain 170588969 more than once!
> at org.infinispan.interceptors.InterceptorChain.assertNotAdded(InterceptorChain.java:76)
> at org.infinispan.interceptors.InterceptorChain.addInterceptor(InterceptorChain.java:90)
> at org.infinispan.cache.impl.CacheImpl.addInterceptor(CacheImpl.java:883)
> at org.hibernate.cache.infinispan.access.PutFromLoadValidator.<init>(PutFromLoadValidator.java:192)
> at org.hibernate.cache.infinispan.access.PutFromLoadValidator.<init>(PutFromLoadValidator.java:133)
> at org.hibernate.cache.infinispan.impl.BaseTransactionalDataRegion.prepareForValidation(BaseTransactionalDataRegion.java:137)
> at org.hibernate.cache.infinispan.impl.BaseTransactionalDataRegion.createAccessDelegate(BaseTransactionalDataRegion.java:122)
> at org.hibernate.cache.infinispan.collection.CollectionRegionImpl.buildAccessStrategy(CollectionRegionImpl.java:49)
> at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:400)
> at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
> at org.hibernate.boot.internal.MetadataImpl.buildSessionFactory(MetadataImpl.java:170)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the infinispan-issues
mailing list