QueryService doLookupQueryService() { return Optional.ofNullable(this.queryService).orElseGet(() -> (this.cache instanceof ClientCache ? ((ClientCache) this.cache).getLocalQueryService() : this.cache.getQueryService())); }
QueryService doLookupQueryService() { return Optional.ofNullable(this.queryService).orElseGet(() -> (this.cache instanceof ClientCache ? ((ClientCache) this.cache).getLocalQueryService() : this.cache.getQueryService())); }
/** * Set the underlying RegionService (Pivotal GemFire Cache) used for registering Queries. * * @param cache the RegionService (Pivotal GemFire Cache) used for registering Queries. * @see org.apache.geode.cache.RegionService */ public void setCache(RegionService cache) { setQueryService(cache.getQueryService()); }
/** * Set the underlying RegionService (GemFire Cache) used for registering Queries. * * @param cache the RegionService (GemFire Cache) used for registering Queries. * @see org.apache.geode.cache.RegionService */ public void setCache(RegionService cache) { setQueryService(cache.getQueryService()); }
QueryService queryServiceFrom(Region<?, ?> region) { return region.getRegionService().getQueryService(); }
QueryService queryServiceFrom(Region<?, ?> region) { return region.getRegionService().getQueryService(); }
public static <T extends RegionService> T mockQueryService(T regionService) { QueryService mockQueryService = mockQueryService(); when(regionService.getQueryService()).thenReturn(mockQueryService); if (regionService instanceof ClientCache) { when(((ClientCache) regionService).getLocalQueryService()).thenReturn(mockQueryService); } return regionService; }
private CqQuery startCQ(ClientCache cache, Region region) throws CqException, RegionNotFoundException, CqExistsException { // Get cache and queryService - refs to local cache and QueryService CqAttributesFactory cqf = new CqAttributesFactory(); cqf.addCqListener(new RandomEventListener()); CqAttributes cqa = cqf.create(); String cqName = "randomTracker"; String queryStr = "SELECT * FROM /example-region i where i > 70"; QueryService queryService = region.getRegionService().getQueryService(); CqQuery randomTracker = queryService.newCq(cqName, queryStr, cqa); randomTracker.execute(); System.out.println("------- CQ is running\n"); return randomTracker; }