Bug 1163040
| Summary: | CDI uses default EmbeddedCacheManager producer from infinispan-cdi.jar instead of custom one | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [JBoss] JBoss Data Grid 6 | Reporter: | Vitalii Chepeliuk <vchepeli> | ||||
| Component: | Infinispan | Assignee: | Vitalii Chepeliuk <vchepeli> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Martin Gencur <mgencur> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 6.4.0 | CC: | jdg-bugs, rmarwaha, slaskawi, vjuranek | ||||
| Target Milestone: | ER1 | ||||||
| Target Release: | 6.5.0 | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2015-06-23 12:24:45 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
|
Description
Vitalii Chepeliuk
2014-11-12 09:37:29 UTC
Created attachment 956658 [details]
Add cdi-reproducer.zip
Inside of reproducer you can find interceptor tests which fail when wrong EmbeddedCacheManager is used.
btw: there's already BZ #1142474, older, but less informative. I'll pass to the asignee which one should be closed as duplicate:-) Sebastian Łaskawiec <slaskawi> updated the status of jira ISPN-4971 to Closed *** Bug 1142474 has been marked as a duplicate of this bug. *** When deploying this code on App Server, there is a race condition in DefaultEmbeddedCacheManagerProducer#getDefaultEmbeddedCacheManager. Those EmbeddedCache producers are deployed in separate deployment units (the former is in CDI Extension and the latter in WAR). On the other hand this approach works fine in CDI module, mainly because there is only one deployment unit there.
Since @OverrideDefault is deprecated, I suggest modifying test code like this:
public class EmbeddedCacheManagerProducer {
@Produces
@ApplicationScoped
public EmbeddedCacheManager getDefaultEmbeddedCacheManager(Configuration defaultConfiguration) {
GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains(true).build();
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.read(defaultConfiguration);
return new DefaultCacheManager(globalConfiguration, builder.build());
}
private void stopCacheManager(@Disposes EmbeddedCacheManager defaultEmbeddedCacheManager) {
defaultEmbeddedCacheManager.stop();
}
}
Note that @OverrideDefault is gone and there is no need to check whether there is an instance of EmbeddedCache (Instance<EmbeddedCacheManager>).
The correct implementation is mentioned in Infinispan's manual: http://infinispan.org/docs/7.1.x/user_guide/user_guide.html#_override_the_default_embedded_cache_manager_and_configuration
|