[infinispan-issues] [JBoss JIRA] Commented: (ISPN-1338) Using cache on a Singleton bean
Kevin Pollet (JIRA)
jira-events at lists.jboss.org
Mon Aug 22 15:47:17 EDT 2011
[ https://issues.jboss.org/browse/ISPN-1338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12622559#comment-12622559 ]
Kevin Pollet commented on ISPN-1338:
------------------------------------
I've tried to reproduce the bug without success.
Could you provide a test project?
> Using cache on a Singleton bean
> -------------------------------
>
> Key: ISPN-1338
> URL: https://issues.jboss.org/browse/ISPN-1338
> Project: Infinispan
> Issue Type: Enhancement
> Components: CDI integration
> Affects Versions: 5.0.0.CR8, 5.0.0.FINAL, 5.1.0.FINAL
> Environment: infinispan-cdi 5.1.0-SNAPSHOT, jboss AS 7 (all libs packaged within ear)
> Reporter: Vinicius Carvalho
> Assignee: Kevin Pollet
> Priority: Optional
>
> I'm trying to get the CDI examples to work on an app. so I've created this config:
> @Produces
> @ApplicationScoped
> @OverrideDefault
> public EmbeddedCacheManager getCacheManager() {
> GlobalConfiguration gc = GlobalConfiguration.getClusteredDefault();
> gc.fluent().transport().clusterName("shared-cache-cluster").addProperty("configurationFile", "jgroups-tcp.xml");
> Configuration c = new Configuration().fluent().clustering().mode(CacheMode.REPL_ASYNC).build();
> return new DefaultCacheManager(gc,c);
> }
> BTW, trying to use configuration and @Infinispan with this I get an error when CacheManager tries to get the cache, I've discussed it at http://community.jboss.org/thread/171005?tstart=0
> Well, my scenario has 2 apps one on each node. So in one node I put a value in the distributed cache, and I expect to receive an event on the other node.
> My problem is that the events for a cache are only hooked when the cache is first accessed (According to CacheManager:getAdvancedCache).
> So, in my second ear, if there's no "warm-up" of the cache, the events do not get hooked and I don't get any notification.
> So I tried to use a Singleton:
> @Singleton
> @Startup
> public class CacheWarmupBean(){
> @Inject Cache<String,String> cache;
> @PostConstruct
> void warm(){
> cache.getCacheName();
> }
> }
> Problem is that the bean gets started before the extension, and no target is found for the cache.
> I wonder, is it possible to either warmup the cache on a different way or hook the events?
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the infinispan-issues
mailing list