Java Code Examples for org.apache.geode.cache.Region#getRegionService()

The following examples show how to use org.apache.geode.cache.Region#getRegionService() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultQueryServiceResolver.java    From immutables with Apache License 2.0 5 votes vote down vote up
private static QueryService resolveClientQueryService(Region<?, ?> region) {
  Preconditions.checkArgument(region.getRegionService() instanceof ClientCache, "Expected to get %s got %s for region %s", ClientCache.class, region.getRegionService(), region.getFullPath());
  ClientCache clientCache = (ClientCache) region.getRegionService();

  return requiresLocalQueryService(region) ? clientCache.getLocalQueryService()
          : (requiresPooledQueryService(region) ? clientCache.getQueryService(poolNameFrom(region))
          : queryServiceFrom(region));
}
 
Example 2
Source File: DefaultQueryServiceResolver.java    From immutables with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the {@link QueryService} used by this template in its query/finder methods.
 *
 * @param region {@link Region} used to acquire the {@link QueryService}.
 * @return the {@link QueryService} that will perform the query.
 * @see Region
 * @see Region#getRegionService()
 * @see org.apache.geode.cache.RegionService#getQueryService()
 * @see org.apache.geode.cache.client.ClientCache#getLocalQueryService()
 */
@Override
public QueryService resolve(Region<?, ?> region) {
  Objects.requireNonNull(region, "region");
  return region.getRegionService() instanceof ClientCache
          ? resolveClientQueryService(region)
          : queryServiceFrom(region);
}