/**
  * Set a random DiskStore for the region defined with regionConfigName if it is persistent or has
  * eviction with overflow to disk.
  *
  * @param regionConfigName A hydra region config name. return factory The attributes factory for
  *     the regionConfigName with possibly a DiskStore.
  */
 public static AttributesFactory setDiskStoreIfNeeded(String regionConfigName) {
   AttributesFactory factory = RegionHelper.getAttributesFactory(regionConfigName);
   RegionDescription desc = RegionHelper.getRegionDescription(regionConfigName);
   EvictionAttributes evAttr = desc.getEvictionAttributes();
   if ((desc.getDataPolicy().withPersistence())
       || ((evAttr != null) && (evAttr.getAction().isOverflowToDisk()))) {
     List diskStoreNames = TestConfig.tab().vecAt(DiskStorePrms.names);
     factory.setDiskStoreName(
         (String)
             (diskStoreNames.get(
                 TestConfig.tab().getRandGen().nextInt(1, diskStoreNames.size() - 1))));
   }
   return factory;
 }
示例#2
0
 public static CqListener getCQListener() {
   Long key = cqListener;
   String val = tasktab().stringAt(key, tab().stringAt(key, null));
   if (val == null) {
     String s = "Missing value for " + nameForKey(key);
     throw new HydraConfigException(s);
   } else {
     try {
       return (CqListener) RegionDescription.getInstance(key, val);
     } catch (ClassCastException e) {
       String s = nameForKey(key) + " does not implement CqListener";
       throw new HydraConfigException(s);
     }
   }
 }