]
Dan Berindei updated ISPN-11926:
--------------------------------
Status: Pull Request Sent (was: Open)
Git Pull Request:
Remote JCacheManager creates two RemoteCacheManager instances
-------------------------------------------------------------
Key: ISPN-11926
URL:
https://issues.redhat.com/browse/ISPN-11926
Project: Infinispan
Issue Type: Bug
Components: Hot Rod, JCache
Affects Versions: 11.0.0.CR1, 10.1.8.Final
Reporter: Dan Berindei
Assignee: Dan Berindei
Priority: Major
Fix For: 11.0.0.Final
{{org.infinispan.jcache.remote.JCacheManager}} creates two {{RemoteCacheManager}}
instances, one with {{forceReturnValues(false)}} and one with {{forceReturnValues(true)}}.
This is wasteful, because each {{RemoteCacheManager}} will create its own server
connections and threads.
It also breaks {{JCache}} listeners when the user explicitly sets the marshaller to
{{org.infinispan.commons.marshall.ProtoStreamMarshaller}}, because {{JCacheManager}}
registers the {{KeyValueWithPrevious}} marshaller (from {{GlobalContextInitializer}}) in
only one of the managers.
The test suites work by accident:
* The {{jcache/remote}} test suite doesn't configure a marshaller, instead
{{ConfigurationBuilder.build()}} creates a {{ProtostreamMarshaller}} instance (because
{{jboss-marshalling}} is not on the classpath) and the next {{Configuration.build()}} call
uses **the same {{ProtostreamMarshaller}} instance**, so the {{RemoteCacheManager}}s share
the serialization context.
* The {{jcache/tck-runner-remote}} test suite has {{jboss-marshalling}} on the classpath
from the {{server/runtime}} dependency, so it uses {{GenericJBossMarshaller}}.