private void createRegion(boolean accessor, int redundantCopies, InterestPolicy interestPolicy) {
   AttributesFactory af = new AttributesFactory();
   af.setScope(Scope.DISTRIBUTED_ACK);
   af.setDataPolicy(DataPolicy.REPLICATE);
   af.setCloningEnabled(true);
   getCache().createRegion(D_REFERENCE, af.create());
   af = new AttributesFactory();
   af.setCloningEnabled(true);
   if (interestPolicy != null) {
     af.setSubscriptionAttributes(new SubscriptionAttributes(interestPolicy));
   }
   af.setPartitionAttributes(
       new PartitionAttributesFactory<CustId, Customer>()
           .setTotalNumBuckets(4)
           .setLocalMaxMemory(accessor ? 0 : 1)
           .setPartitionResolver(new CustomerIDPartitionResolver("resolver1"))
           .setRedundantCopies(redundantCopies)
           .create());
   getCache().createRegion(CUSTOMER, af.create());
   af.setPartitionAttributes(
       new PartitionAttributesFactory<OrderId, Order>()
           .setTotalNumBuckets(4)
           .setLocalMaxMemory(accessor ? 0 : 1)
           .setPartitionResolver(new CustomerIDPartitionResolver("resolver2"))
           .setRedundantCopies(redundantCopies)
           .setColocatedWith(CUSTOMER)
           .create());
   getCache().createRegion(ORDER, af.create());
 }
 @Override
 public Region createRegion(String regionName, Class valueConstraint) {
   PartitionAttributesFactory paf = new PartitionAttributesFactory();
   AttributesFactory af = new AttributesFactory();
   af.setPartitionAttributes(paf.create());
   af.setValueConstraint(valueConstraint);
   Region r1 = CacheUtils.createRegion(regionName, af.create(), false);
   return r1;
 }
 @SuppressWarnings({"unchecked", "deprecation", "rawtypes"})
 void createRegion(String name, boolean accessor, int redundantCopies, CacheWriter<?, ?> cw) {
   AttributesFactory af = new AttributesFactory();
   af.setPartitionAttributes(
       new PartitionAttributesFactory()
           .setLocalMaxMemory(accessor ? 0 : 12)
           .setRedundantCopies(redundantCopies)
           .create());
   af.setCacheWriter(cw);
   getCache().createRegion(name, af.create());
 }
  protected AttributesFactory getServerCacheAttributesFactory(boolean enableStorage) {
    AttributesFactory factory = new AttributesFactory();
    PartitionAttributesFactory paf = new PartitionAttributesFactory();
    factory.setDataPolicy(DataPolicy.PARTITION);
    paf.setRedundantCopies(0).setTotalNumBuckets(1);
    if (!enableStorage) {
      paf.setLocalMaxMemory(0);
    }

    factory.setPartitionAttributes(paf.create());
    return factory;
  }
Пример #5
0
 /**
  * Commented the test as it is for some reason causing OOM when run in the suite. It is due to
  * presence of PR Tests the where clause formed with CompiledComparison nesting with CompiledIN
  *
  * @throws Exception
  */
 public void _testBug40333_InPartitionedRegion_2() throws Exception {
   CacheUtils.startCache();
   final Cache cache = CacheUtils.getCache();
   AttributesFactory attributesFactory = new AttributesFactory();
   PartitionAttributesFactory paf = new PartitionAttributesFactory();
   paf.setTotalNumBuckets(10);
   PartitionAttributes pa = paf.create();
   attributesFactory.setPartitionAttributes(pa);
   RegionAttributes ra = attributesFactory.create();
   final Region region = cache.createRegion("new_pos", ra);
   String queryStr =
       " select distinct r.name, pVal, r.\"type\"  "
           + " from /new_pos r , r.positions.values pVal where "
           + " ( r.name IN Set('name_11' , 'name_12') OR false ) AND pVal.mktValue < 1.00";
   this.bug40333Simulation(region, queryStr);
 }