[infinispan-dev] getting stopped cache
Dan Berindei
dan.berindei at gmail.com
Tue Aug 28 03:25:02 EDT 2012
Cache.stop() should not remove the cache from the cache manager.
But AFAIK the ComponentRegistry that holds all the cache-scoped components
is destroyed, and recreated by Cache.start(). In the constructor it should
register Query's CommandInitializer again, so LifecycleManager should find
it and you shouldn't get the NPE...
Dan
On Tue, Aug 28, 2012 at 12:15 AM, Ales Justin <ales.justin at gmail.com> wrote:
> Uh, the workaround results in NPE:
>
> 23:10:27,160 ERROR
> [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host]]
> (http-/192.168.1.101:8080-2) Exception sending request initialized
> lifecycle event to listener instance of class
> org.jboss.capedwarf.appidentity.GAEListener: java.lang.NullPointerException
> at
> org.infinispan.query.impl.LifecycleManager.cacheStarted(LifecycleManager.java:125)
> at
> org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:178)
> [infinispan-core-5.2.0.ALPHA2.jar:5.2.0.ALPHA2]
> at org.infinispan.CacheImpl.start(CacheImpl.java:523)
> [infinispan-core-5.2.0.ALPHA2.jar:5.2.0.ALPHA2]
> at
> org.infinispan.AbstractDelegatingCache.start(AbstractDelegatingCache.java:343)
> [infinispan-core-5.2.0.ALPHA2.jar:5.2.0.ALPHA2]
> at
> org.jboss.capedwarf.common.infinispan.InfinispanUtils.checkCache(InfinispanUtils.java:72)
> [capedwarf-common-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
> at
> org.jboss.capedwarf.common.infinispan.InfinispanUtils.getCache(InfinispanUtils.java:82)
> [capedwarf-common-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
>
> This is the code I added:
>
> private static <K, V> Cache<K, V> checkCache(String cacheName) {
> final Cache<K, V> cache = cacheManager.getCache(cacheName, false);
> if (cache != null) {
> final ComponentStatus status = cache.getStatus();
> if (status != ComponentStatus.INITIALIZING && status !=
> ComponentStatus.RUNNING) {
> cache.start();
> }
> }
> return cache;
> }
>
> Any other idea?
>
> -Ales
>
> On Aug 27, 2012, at 10:51 PM, Ales Justin <ales.justin at gmail.com> wrote:
>
> > OK, let me try this workaround.
> >
> > But should Cache::stop also remove it or not?
> >
> > If yes, I might dig deeper into finding the culprit,
> > if not, then the workaround should do, I guess.
> >
> > -Ales
> >
> >> As a workaround, couldn't you check what the status of the cache is
> before using it? If it's stopped, you could call cache.start() again.
> >>
> >> On Aug 25, 2012, at 3:44 PM, Ales Justin wrote:
> >>
> >>> When running CapeDwarf tests these days I get this broken behavior:
> >>> (using: Ispan 5.2.0.Alpha2)
> >>>
> >>> On 1st test all works OK:
> >>> * getting the X cache
> >>> * passing it to SearchManager (from Ispan Query)
> >>> * doing queries, etc
> >>> * stopping the X cache on app (aka Arquillian test) undeploy
> >>>
> >>> But when running 2nd app (more Arquillian tests) it breaks.
> >>>
> >>> I'm again using X cache, via this lookup:
> >>> (where toCacheName == X)
> >>>
> >>> final Cache<K, V> cache =
> cacheManager.getCache(toCacheName(config, appId), false);
> >>> if (cache != null)
> >>> return cache;
> >>>
> >>> And I actually get some cache, where I would expect none.
> >>>
> >>> Since this cache is not new, it's never run against Ispan Query's
> LifecycleManager,
> >>> hence there is no QueryInterceptor in its component registry.
> >>>
> >>> Which is where the app breaks: SearchManager requires QueryInterceptor
> in cache' component registry.
> >>>
> >>> Shouldn't Cache::stop also remove the cache from EmbeddedCacheManager?
> >>> btw: this used to work, dunno when it broke ...
> >>>
> >>> Anyone else seeing something similar?
> >>>
> >>> -Ales
> >>>
> >>> ----------
> >>>
> >>> 15:32:06,810 ERROR
> [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host]]
> (http-/192.168.1.101:8080-3) Exception sending request initialized
> lifecycle event to listener instance of class
> org.jboss.capedwarf.appidentity.GAEListener:
> java.lang.IllegalArgumentException: Indexing was not enabled on this cache.
> class org.infinispan.query.backend.QueryInterceptor not found in registry
> >>> at
> org.infinispan.query.impl.ComponentRegistryUtils.getComponent(ComponentRegistryUtils.java:40)
> >>> at
> org.infinispan.query.SearchManagerImpl.<init>(SearchManagerImpl.java:57)
> >>> at org.infinispan.query.Search.getSearchManager(Search.java:39)
> >>> at
> org.jboss.capedwarf.datastore.AbstractDatastoreService.<init>(AbstractDatastoreService.java:61)
> [capedwarf-datastore-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
> >>> at
> org.jboss.capedwarf.datastore.JBossDatastoreService.<init>(JBossDatastoreService.java:56)
> [capedwarf-datastore-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
> >>> at
> com.google.appengine.api.datastore.DatastoreServiceFactory.getDatastoreService(DatastoreServiceFactory.java)
> [appengine-api-1.0-sdk-1.7.0.jar:]
> >>> at
> org.jboss.capedwarf.log.JBossLogService.requestStarted(JBossLogService.java:215)
> [capedwarf-log-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
> >
>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/infinispan-dev/attachments/20120828/0e83f244/attachment.html
More information about the infinispan-dev
mailing list