]
RH Bugzilla Integration commented on ISPN-4971:
-----------------------------------------------
Dave Stahl <dstahl(a)redhat.com> changed the Status of [bug
CDI uses default EmbeddedCacheManager producer from
infinispan-cdi.jar instead of custom one
--------------------------------------------------------------------------------------------
Key: ISPN-4971
URL:
https://issues.jboss.org/browse/ISPN-4971
Project: Infinispan
Issue Type: Bug
Components: CDI Integration
Affects Versions: 7.0.0.CR1, 7.0.0.CR2, 7.0.0.Final
Reporter: Vitalii Chepeliuk
Assignee: Sebastian Ćaskawiec
Custom producer has allowDuplicateDomains set to true look following code
{code}
public class EmbeddedCacheManagerProducer {
/**
* Produces the default embedded cache manager.
*
* @param providedDefaultEmbeddedCacheManager the provided default embedded cache
manager.
* @param defaultConfiguration the default configuration produced by the {@link
EmbeddedCacheManagerProducer}.
* @return the default embedded cache manager used by the application.
*/
@Produces
@ApplicationScoped
public EmbeddedCacheManager getDefaultEmbeddedCacheManager(@OverrideDefault
Instance<EmbeddedCacheManager> providedDefaultEmbeddedCacheManager, Configuration
defaultConfiguration) {
GlobalConfiguration globalConfiguration = new
GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains(true).build();
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.read(defaultConfiguration);
return new DefaultCacheManager(globalConfiguration, builder.build());
}
/**
* Stops the default embedded cache manager when the corresponding instance is
released.
*
* @param defaultEmbeddedCacheManager the default embedded cache manager.
*/
private void stopCacheManager(@Disposes EmbeddedCacheManager
defaultEmbeddedCacheManager) {
defaultEmbeddedCacheManager.stop();
}
}
{code}
And default ones from infinispan-cdi.jar is
{code}
public class DefaultEmbeddedCacheManagerProducer {
private static final Log log =
LogFactory.getLog(DefaultEmbeddedCacheManagerProducer.class, Log.class);
/**
* Produces the default embedded cache manager.
*
* @param providedDefaultEmbeddedCacheManager the provided default embedded cache
manager.
* @param defaultConfiguration the default configuration produced by the {@link
DefaultEmbeddedCacheConfigurationProducer}.
* @return the default embedded cache manager used by the application.
*/
@Produces
@ApplicationScoped
@DefaultBean(EmbeddedCacheManager.class)
public EmbeddedCacheManager getDefaultEmbeddedCacheManager(@OverrideDefault
Instance<EmbeddedCacheManager> providedDefaultEmbeddedCacheManager, Configuration
defaultConfiguration) {
if (!providedDefaultEmbeddedCacheManager.isUnsatisfied()) {
log.tracef("Default embedded cache manager overridden by
'%s'", providedDefaultEmbeddedCacheManager);
return providedDefaultEmbeddedCacheManager.get();
}
return new DefaultCacheManager(defaultConfiguration);
}
/**
* Stops the default embedded cache manager when the corresponding instance is
released.
*
* @param defaultEmbeddedCacheManager the default embedded cache manager.
*/
private void stopCacheManager(@Disposes EmbeddedCacheManager
defaultEmbeddedCacheManager) {
defaultEmbeddedCacheManager.stop();
}
}
{code}
When tests are deployed to APP server then following ERROR occurs
10:19:58,494 ERROR [org.infinispan.jmx.JmxUtil]
(http-localhost.localdomain/127.0.0.1:8080-1) ISPN000034: There's already an cache
manager instance registered under 'org.infinispan' JMX domain. If you want to
allow multiple instances configured with same JMX domain enable
'allowDuplicateDomains' attribute in 'globalJmxStatistics' config element
10:19:58,526 ERROR [org.infinispan.jmx.JmxUtil]
(http-localhost.localdomain/127.0.0.1:8080-1) ISPN000034: There's already an cache
manager instance registered under 'org.infinispan' JMX domain. If you want to
allow multiple instances configured with same JMX domain enable
'allowDuplicateDomains' attribute in 'globalJmxStatistics' config element
10:19:58,598 ERROR [org.infinispan.jmx.JmxUtil]
(http-localhost.localdomain/127.0.0.1:8080-1) ISPN000034: There's already an cache
manager instance registered under 'org.infinispan' JMX domain. If you want to
allow multiple instances configured with same JMX domain enable
'allowDuplicateDomains' attribute in 'globalJmxStatistics' config element
What means that out custom producer is sometimes not used and does not override default
produced EmbeddedCacheManager