/**
  * 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;
 }
  protected RegionMBeanBridge(Region<K, V> region) {
    this.region = region;
    this.regAttrs = region.getAttributes();

    this.isStatisticsEnabled = regAttrs.getStatisticsEnabled();

    this.regionAttributesData = RegionMBeanCompositeDataFactory.getRegionAttributesData(regAttrs);
    this.membershipAttributesData =
        RegionMBeanCompositeDataFactory.getMembershipAttributesData(regAttrs);
    this.evictionAttributesData =
        RegionMBeanCompositeDataFactory.getEvictionAttributesData(regAttrs);

    this.regionMonitor =
        new MBeanStatsMonitor(ManagementStrings.REGION_MONITOR.toLocalizedString());

    configureRegionMetrics();

    this.persistentEnabled = region.getAttributes().getDataPolicy().withPersistence();

    this.regionStats = ((LocalRegion) region).getRegionPerfStats();
    if (regionStats != null) {
      regionMonitor.addStatisticsToMonitor(regionStats.getStats()); // fixes 46692
    }

    LocalRegion l = (LocalRegion) region;
    if (l.getEvictionController() != null) {
      LRUStatistics stats = l.getEvictionController().getLRUHelper().getStats();
      if (stats != null) {
        regionMonitor.addStatisticsToMonitor(stats.getStats());
        EvictionAttributes ea = region.getAttributes().getEvictionAttributes();
        if (ea != null && ea.getAlgorithm().isLRUMemory()) {
          this.lruMemoryStats = stats;
        }
      }
    }

    if (regAttrs.getGatewaySenderIds() != null && regAttrs.getGatewaySenderIds().size() > 0) {
      this.isGatewayEnabled = true;
    }

    this.member = GemFireCacheImpl.getInstance().getDistributedSystem().getMemberId();
  }