diff --git a/query/src/main/java/org/infinispan/query/impl/LifecycleManager.java b/query/src/main/java/org/infinispan/query/impl/LifecycleManager.java index 661478a83f26..785fe74f7aaf 100644 --- a/query/src/main/java/org/infinispan/query/impl/LifecycleManager.java +++ b/query/src/main/java/org/infinispan/query/impl/LifecycleManager.java @@ -140,13 +140,14 @@ public void cacheStopping(ComponentRegistry cr, String cacheName) { //TODO move this to cacheStopped event (won't work right now as the ComponentRegistry is half empty at that point: ISPN-1006) SearchFactoryIntegrator searchFactoryImplementor = cr.getComponent(SearchFactoryIntegrator.class); if (searchFactoryImplementor != null) { + cr.registerComponent(NoOpSearchFactory.INSTANCE, SearchFactoryIntegrator.class); searchFactoriesToShutdown.put(cacheName, searchFactoryImplementor); } } @Override public void cacheStopped(ComponentRegistry cr, String cacheName) { - SearchFactoryIntegrator searchFactoryIntegrator = searchFactoriesToShutdown.get(cacheName); + SearchFactoryIntegrator searchFactoryIntegrator = searchFactoriesToShutdown.remove(cacheName); if (searchFactoryIntegrator != null) { searchFactoryIntegrator.close(); }