Beispiel #1
0
  @SuppressWarnings({"rawtypes", "unchecked"})
  protected void initializeRegion() {
    String regionName = DQueue.NAME_PREFIX + this.id;
    Region region = this.cache.getRegion(regionName);
    boolean createdRegion = false;

    // Create the dq region if necessary
    if (region == null) {
      GemFireCacheImpl gfci = (GemFireCacheImpl) this.cache;
      if (gfci.isClient()) {
        // can't use the createRegion method if this cache is a client-cache
        ClientRegionFactory factory = gfci.createClientRegionFactory(ClientRegionShortcut.PROXY);
        factory.setPoolName(this.dqAttributes.getPoolName());
        region = factory.create(regionName);
      } else {
        AttributesFactory factory = new AttributesFactory();
        factory.setDataPolicy(DataPolicy.EMPTY);
        factory.setScope(Scope.LOCAL);
        factory.setPoolName(this.dqAttributes.getPoolName());
        region = this.dqRegion = this.cache.createRegion(regionName, factory.create());
        createdRegion = true;
      }
    }

    this.dqRegion = region;

    if (this.cache.getLogger().fineEnabled()) {
      this.cache
          .getLogger()
          .fine(
              this
                  + ": "
                  + (createdRegion ? "Created" : "Retrieved")
                  + " DQueue region: "
                  + this.dqRegion.getFullPath());
    }
  }