当前位置: 首页>>代码示例>>Java>>正文


Java Cache.rootRegions方法代码示例

本文整理汇总了Java中com.gemstone.gemfire.cache.Cache.rootRegions方法的典型用法代码示例。如果您正苦于以下问题:Java Cache.rootRegions方法的具体用法?Java Cache.rootRegions怎么用?Java Cache.rootRegions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.gemstone.gemfire.cache.Cache的用法示例。


在下文中一共展示了Cache.rootRegions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllRegionNames

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
public static Set<String> getAllRegionNames() {
  Cache cache = CacheFactory.getAnyInstance();
  Set<String> regionNames = new HashSet<String>();
  Set<Region<?,?>> rootRegions = cache.rootRegions();

  Iterator<Region<?,?>> rootRegionIters = rootRegions.iterator();

  while (rootRegionIters.hasNext()) {
    Region<?,?> rootRegion = rootRegionIters.next();
    regionNames.add(rootRegion.getFullPath().substring(1));

    Set<Region<?, ?>> subRegions = rootRegion.subregions(true);
    Iterator<Region<?,?>> subRegionIters = subRegions.iterator();

    while (subRegionIters.hasNext()) {
      Region<?,?> subRegion = subRegionIters.next();
      regionNames.add(subRegion.getFullPath().substring(1));
    }
  }
  return regionNames;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:22,代码来源:CliUtil.java

示例2: createBuckets

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
private void createBuckets() throws InterruptedException {
  Cache c = CacheHelper.getCache();
  if (c != null) {
    for (Region r : c.rootRegions()) {
      if (r.getAttributes().getDataPolicy().withPartitioning()) {
         Log.getLogWriter().info("Creating buckets for region "
                                 + r.getName());
         PartitionRegionHelper.assignBucketsToPartitions(r);
         RebalanceFactory rf = CacheHelper.getCache().getResourceManager()
                                          .createRebalanceFactory();
         RebalanceOperation ro = rf.start();
         RebalanceResults results = ro.getResults(); // blocking call
         Log.getLogWriter().info("Created buckets for region " + r.getName());
      }
    }
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:18,代码来源:GFClient.java

示例3: endDiskRecovery

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
 * @param record stat for end of recovery
 */
public static void endDiskRecovery(long elapsed, DistCache theCache, Statistics stats) {
  if (theCache instanceof GemFireCacheTestImpl) {
    Cache gfCache = CacheHelper.getCache();
    Set<Region<?, ?>> aSet = gfCache.rootRegions();
    for (Region aRegion: aSet) {
      DiskRegion dr = ((LocalRegion)aRegion).getDiskRegion();
      if (dr != null) {
        DiskRegionStats diskStats = dr.getStats();
        long localInit = diskStats.getLocalInitializations();
        long remoteInit = diskStats.getRemoteInitializations();
        if (localInit > 0) {
          incLocalRecoveryTime(elapsed, stats);
        } 
        if (remoteInit > 0) {
          incRemoteRecoveryTime(elapsed, stats);
        }
      }
    }
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:24,代码来源:CachePerfStatsVersion.java

示例4: destroyWanQueues

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public static void  destroyWanQueues() {
  try{
    Cache cache = com.gemstone.gemfire.cache.CacheFactory.getAnyInstance();
    for (Iterator i = cache.getGatewayHubs().iterator(); i.hasNext();) {
      GatewayHub hub = (GatewayHub) i.next();
      for (Iterator i1 = hub.getGateways().iterator(); i1.hasNext();) {
        Gateway gateway = (Gateway) i1.next();
        String rq= new StringBuffer(gateway.getGatewayHubId()).append('_').append(gateway.getId()).append("_EVENT_QUEUE").toString();
        Region wbcl = cache.getRegion(rq);
        if(wbcl != null) {
          wbcl.localDestroyRegion();
        }         
      }  
    }
    Set<Region<?, ?>> rootRegions = cache.rootRegions();
    if (rootRegions != null) {
      for (Region<?, ?> region : rootRegions) {
        region.clear();
      }
    }
  } catch (CancelException cce) {
    //Ignore
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:26,代码来源:MemberInfoWithStatsMBeanGFEValidationDUnitTest.java

示例5: getAllRegions

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/** Return a Set of all regions defined in this member.
 * 
 * @return A Set of all regions defined in this member.
 */
public static Set<Region<?, ?>> getAllRegions() {
  // get all regions
  Cache theCache = CacheHelper.getCache();
  if (theCache == null) {
    Log.getLogWriter().info("There are no regions in this member, cache is null");
    return null;
  }
  Set<Region<?, ?>> rootRegions = theCache.rootRegions();
  Set<Region<?, ?>> allRegions = new HashSet<Region<?, ?>>();
  allRegions.addAll(rootRegions);
  for (Region<?, ?> aRegion: rootRegions) {
    allRegions.addAll(aRegion.subregions(true));
  }
  return allRegions;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:20,代码来源:OffHeapHelper.java

示例6: HydraTask_verifyPrimaries

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/** Hydra task to verify primaries
 */
public static void HydraTask_verifyPrimaries() {
   Cache myCache = CacheHelper.getCache();
   Set<Region<?,?>> rootRegions = myCache.rootRegions();
   boolean highAvailability = TestConfig.tab().booleanAt(ParRegPrms.highAvailability, false);
   for (Region aRegion : rootRegions) {
      if (aRegion instanceof PartitionedRegion) {
         try {
            RegionAttributes attr = aRegion.getAttributes();
            PartitionAttributes prAttr = attr.getPartitionAttributes();
            int redundantCopies = 0;
            if (prAttr != null) { 
               redundantCopies = prAttr.getRedundantCopies();
            }
            if (highAvailability) { // with HA, wait for things to settle down
               ParRegUtil.verifyPrimariesWithWait(aRegion, redundantCopies);
            } else {
               ParRegUtil.verifyPrimaries(aRegion, redundantCopies);
            }
         } catch (Exception e) {
            // shutdownHook will cause all members to dump partitioned region info
            throw new TestException(TestHelper.getStackTrace(e));
         }
      }
   }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:28,代码来源:RebalanceUtil.java

示例7: HydraTask_verifyBucketCopiesBatched

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/** Hydra task to verify bucket copies. This must be called repeatedly
 *  by the same thread until StopSchedulingTaskOnClientOrder is thrown.
 */
public static void HydraTask_verifyBucketCopiesBatched() {
   Cache myCache = CacheHelper.getCache();
   Set<Region<?,?>> rootRegions = myCache.rootRegions();
   for (Region aRegion : rootRegions) {
      if (aRegion instanceof PartitionedRegion) {
         try {
            RegionAttributes attr = aRegion.getAttributes();
            PartitionAttributes prAttr = attr.getPartitionAttributes();
            int redundantCopies = 0;
            if (prAttr != null) { 
               redundantCopies = prAttr.getRedundantCopies();
            }
            // the following call throws StopSchedulingTaskOnClientOrder when completed
            parRegUtilInstance.verifyBucketCopiesBatched(aRegion, redundantCopies);
         } catch (TestException e) {
            // shutdownHook will cause all members to dump partitioned region info
            throw new TestException(TestHelper.getStackTrace(e));
         }
      }
   }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:25,代码来源:RebalanceUtil.java

示例8: regionHierarchyToString

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/** Return a string representation of the region hierarchy for this test. 
 * 
 */
protected static String regionHierarchyToString() {
  Cache theCache = CacheHelper.getCache();
  if (theCache == null) {
    return "Cache is null; unable to get region hierarchy";
  }
  Set<Region<?,?>> roots = theCache.rootRegions();
  StringBuffer aStr = new StringBuffer();
  int totalNumRegions = 0;
  for (Region aRegion: roots) {
    aStr.append(aRegion.getFullPath() + "  (size " + aRegion.size() + " dataPolicy " +
        aRegion.getAttributes().getDataPolicy() + " eviction " + aRegion.getAttributes().getEvictionAttributes());
    RecoveryTestVersionHelper.logDiskStore(aRegion, aStr);
    aStr.append(")\n");
    totalNumRegions++;
    Object[] tmp = subregionsToString(aRegion, 1);
    aStr.append(tmp[0]);
    totalNumRegions += (Integer)(tmp[1]);
  }
  return "Region hierarchy with " + totalNumRegions + " regions\n" + aStr.toString();
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:24,代码来源:RecoveryTest.java

示例9: getRegionsStr

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
public static String getRegionsStr(Cache gfCache) {
  StringBuilder sb = new StringBuilder();
  sb.append("Available regions: \n");
  for (Object regionObj : gfCache.rootRegions()) {
    Region<?, ?> region = (Region<?, ?>)regionObj;
    sb.append("\tRoot region: " + region.getFullPath() + "\n");
    for (Object subRegionObj : region.subregions(true)) {
      Region<?, ?> subRegion = (Region<?, ?>)subRegionObj;
      sb.append("\t\tSubregion: " + subRegion.getFullPath() + "\n");
    }
  }
  return sb.toString();
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:14,代码来源:DistributedSQLTestBase.java

示例10: getAllRegionPaths

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
 * Returns a sorted list of all region full paths found in the specified
 * cache.
 * @param cache The cache to search.
 * @param recursive recursive search for sub-regions
 * @return Returns a sorted list of all region paths defined in the 
 *         distributed system.  
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public static List getAllRegionPaths(Cache cache, boolean recursive)
{
  ArrayList list = new ArrayList();
  if (cache == null) {
    return list;
  }
  
  // get a list of all root regions
Set regions = cache.rootRegions();
Iterator itor = regions.iterator();

while (itor.hasNext()) {
  String regionPath = ((Region)itor.next()).getFullPath();

  Region region = cache.getRegion(regionPath);
  list.add(regionPath);
  Set subregionSet = region.subregions(true);
  if (recursive) {
    for (Iterator subIter = subregionSet.iterator(); subIter.hasNext(); ){
      list.add(((Region)subIter.next()).getFullPath());
    }
  }
}
Collections.sort(list);
return list;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:36,代码来源:DataCommandFunction.java

示例11: getAllRegionPathList

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
   * Returns a sorted list of all region full paths found in the specified
   * cache.
   * @param cache The cache to search.
   * @return Returns a sorted list of all region paths defined in the 
   *         distributed system.  
   */
  public static List getAllRegionPathList(Cache cache, boolean recursive)
  {
  	ArrayList list = new ArrayList();
  	if (cache == null) {
  		return list;
  	}
  	
  	// get a list of all root regions
Set regions = cache.rootRegions();
Iterator itor = regions.iterator();

while (itor.hasNext()) {
	String regionPath = ((Region)itor.next()).getFullPath();

	Region region = cache.getRegion(regionPath);
	list.add(regionPath);
	Set subregionSet = region.subregions(true);
	if (recursive) {
		for (Iterator subIter = subregionSet.iterator(); subIter.hasNext(); ){
			list.add(((Region)subIter.next()).getFullPath());
		}
	}
}
Collections.sort(list);
return list;
  }
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:34,代码来源:RegionUtil.java

示例12: getPartitionedRegions

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
public List<String> getPartitionedRegions() {
  List<String> regionNames = new ArrayList();
  Cache c = CacheHelper.getCache();
  if (c != null) {
    for (Region r : c.rootRegions()) {
      if (r.getAttributes().getDataPolicy().withPartitioning()) {
        regionNames.add(r.getName());
      }
    }
  }
  return regionNames;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:13,代码来源:QueryPerfClient.java

示例13: HydraTask_doOperations

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
public static void HydraTask_doOperations() {
  PdxTest.initClassLoader();
  Operations ops = new Operations();
  ops.initializeOperationsClient();
  Cache theCache = CacheHelper.getCache();
  if (theCache == null) {  // can happen during HA
    return; 
  }
  Set<Region<?, ?>> rootRegions = theCache.rootRegions();
  for (Region aRegion: rootRegions) {
    ops.doEntryOperations(aRegion);
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:14,代码来源:Operations.java

示例14: HydraTask_logLocalSize

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/** Log the local size of the PR data store
 */
public synchronized static void HydraTask_logLocalSize() {
   Cache myCache = CacheHelper.getCache();
   Set<Region<?,?>> rootRegions = myCache.rootRegions();
   for (Region aRegion : rootRegions) {
      if (aRegion instanceof PartitionedRegion) {
         Log.getLogWriter().info("Number of entries in this dataStore for region" + aRegion.getName() + " : " + ParRegUtil.getLocalSize(aRegion));
      }
   } 
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:12,代码来源:RebalanceUtil.java

示例15: HydraTask_verifyPRMetaData

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/** Hydra task to verify metadata
 *  versions of parReg/KnownKeysTest validation methods which verify
 *  all partitionedRegions in the VM.
 */
public static void HydraTask_verifyPRMetaData() {
   Cache myCache = CacheHelper.getCache();
   Set<Region<?,?>> rootRegions = myCache.rootRegions();
   for (Region aRegion : rootRegions) {
      if (aRegion instanceof PartitionedRegion) {
         try {
            ParRegUtil.verifyPRMetaData(aRegion);
         } catch (Exception e) {
           // shutdownHook will cause all members to dump partitioned region info
           throw new TestException(TestHelper.getStackTrace(e));
         }
      }
   }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:19,代码来源:RebalanceUtil.java


注:本文中的com.gemstone.gemfire.cache.Cache.rootRegions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。