protected RegionFactory<?, ?> defineRegionFactory() { return new RegionFactory() .setPartitionAttributes(definePartitionAttributes()); }
@SuppressWarnings({ "rawtypes", "deprecation" }) @Override protected RegionFactory<?, ?> defineRegionFactory() { return new RegionFactory() .setPartitionAttributes(definePartitionAttributes()) .setEnableOffHeapMemory(true); } }
public void createPartitionRegion(String name, Class constraint) { ExpirationAttributes expiration = ExpirationAttributes.DEFAULT; PartitionAttributesFactory paf = new PartitionAttributesFactory(); RegionFactory factory = cache.createRegionFactory(RegionShortcut.PARTITION) .setPartitionAttributes(paf.create()); if (constraint != null) { factory.setValueConstraint(constraint); } factory.create(name); }
@Override protected void setUp() throws Exception { super.setUp(); System.setProperty(HDFSStoreImpl.ALLOW_STANDALONE_HDFS_FILESYSTEM_PROP, "true"); testDataDir = new Path("test-case"); cache = createCache(); configureHdfsStoreFactory(); hdfsStore = (HDFSStoreImpl) hsf.create(HDFS_STORE_NAME); RegionFactory<Object, Object> regionfactory = cache.createRegionFactory(RegionShortcut.PARTITION_HDFS); regionfactory.setHDFSStoreName(HDFS_STORE_NAME); // regionfactory.setCompressionCodec("Some"); PartitionAttributesFactory fac = new PartitionAttributesFactory(); fac.setTotalNumBuckets(10); regionfactory.setPartitionAttributes(fac.create()); region = regionfactory.create(REGION_NAME); }
@Override public void run2() throws CacheException { Properties properties = new Properties(); properties.put(DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME, "2m"); getSystem(properties); GemFireCacheImpl cache = (GemFireCacheImpl) getCache(); RegionFactory regionFactory = cache.createRegionFactory(RegionShortcut.PARTITION); PartitionAttributes partitionAttributes = new PartitionAttributesFactory().setLocalMaxMemory(0).create(); regionFactory.setPartitionAttributes(partitionAttributes); Region region = regionFactory.create(regionName); assertNotNull("Region is null", region); assertNotNull("Cache does not contain region", cache.getRegion(regionName)); } });
public void run() { Cache cache = getCache(); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setTotalNumBuckets(10); cache.createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(paf.create()).create("region"); } });
@Override public void run() { final Cache cache = getCache(); RegionFactory<Object, Object> factory = cache.createRegionFactory(RegionShortcut.PARTITION); factory.create("Customer"); PartitionAttributesFactory paFactory = new PartitionAttributesFactory(); paFactory.setColocatedWith("Customer"); factory.setPartitionAttributes(paFactory.create()); factory.create("Order"); } });
public void run() { Cache cache = getCache(); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setTotalNumBuckets(10); paf.setLocalMaxMemory(0); cache.createRegionFactory(RegionShortcut.PARTITION_PROXY) .setPartitionAttributes(paf.create()) .create("region"); }
public Object call() throws Exception { RegionFactory<Object, Object> rf = getCache().createRegionFactory(shortcut); if (!shortcut.equals(RegionShortcut.REPLICATE)) { rf.setPartitionAttributes(new PartitionAttributesFactory().setRedundantCopies(2).create()); } rf.create("region"); return null; } };
protected Region<Integer, String> createRegion(String regionName) { RegionFactory<Integer, String> rf = cache.createRegionFactory(RegionShortcut.PARTITION_HDFS); PartitionAttributes prAttr = new PartitionAttributesFactory().setTotalNumBuckets(10).create(); rf.setPartitionAttributes(prAttr); rf.setHDFSStoreName(hdfsStore.getName()); Region<Integer, String> r = rf.create(regionName); ((PartitionedRegion) r).setQueryHDFS(true); return r; }
public void testPutsPartitionedRegion() throws Exception{ PartitionAttributes pa = new PartitionAttributesFactory(). setRedundantCopies(0).setTotalNumBuckets(3).create(); Region region = new RegionFactory().setPartitionAttributes(pa).create("parReg"); checkOpRejection(region, false, true); region.close(); assertEquals(0 + SYSTEM_LISTENERS, cache.getResourceManager(false). getResourceListeners(ResourceType.HEAP_MEMORY).size()); }
public void createPR() { PartitionResolver testKeyBasedResolver = new QueryAPITestPartitionResolver(); cache = CacheFactory.getAnyInstance(); cache .createRegionFactory(RegionShortcut.PARTITION_REDUNDANT) .setPartitionAttributes( new PartitionAttributesFactory() .setTotalNumBuckets(numOfBuckets) .setPartitionResolver(testKeyBasedResolver) .create()) .create(PartitionedRegionName1); }
@Override protected Region<Integer, String> createRegion(String regionName) { RegionFactory<Integer, String> rf = cache.createRegionFactory(RegionShortcut.PARTITION_HDFS); PartitionAttributes prAttr = new PartitionAttributesFactory().setTotalNumBuckets(10).create(); rf.setPartitionAttributes(prAttr); rf.setEnableOffHeapMemory(true); rf.setHDFSStoreName(hdfsStore.getName()); Region<Integer, String> r = rf.create(regionName); // addListener(r); ((PartitionedRegion) r).setQueryHDFS(true); return r; } @Override
@Override protected Region<Integer, String> createRegion(String regionName) { RegionFactory<Integer, String> rf = cache.createRegionFactory(RegionShortcut.PARTITION_HDFS); PartitionAttributes prAttr = new PartitionAttributesFactory().setTotalNumBuckets(10).create(); rf.setPartitionAttributes(prAttr); rf.setEnableOffHeapMemory(true); rf.setHDFSStoreName(hdfsStore.getName()); Region<Integer, String> r = rf.create(regionName); // addListener(r); ((PartitionedRegion) r).setQueryHDFS(true); return r; } @Override
public void testSetPartitionAttributes() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(); PartitionAttributes pa = new PartitionAttributesFactory().setTotalNumBuckets(77).create(); r1 = factory.setPartitionAttributes(pa).create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(pa, ra.getPartitionAttributes()); } finally { cleanUpRegion(r1); } }
protected Region createPersistentRegion(Cache cache, String regionName, String diskStoreName, boolean isPR) { RegionFactory factory; if (isPR) { PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setRedundantCopies(1); factory = cache.createRegionFactory().setDiskStoreName(diskStoreName) .setDataPolicy(DataPolicy.PERSISTENT_PARTITION) .setPartitionAttributes(paf.create()); } else { factory = cache.createRegionFactory().setDiskStoreName(diskStoreName) .setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); } return factory.create(regionName); }
public Object call() throws Exception { RegionFactory<Object, Object> rf = getCache().createRegionFactory(shortcut); if (!shortcut.equals(RegionShortcut.REPLICATE)) { rf.setPartitionAttributes(new PartitionAttributesFactory().setRedundantCopies(2).create()); } rf.create("region"); CacheServer server = getCache().addCacheServer(); int port = AvailablePortHelper.getRandomAvailableTCPPort(); server.setPort(port); server.start(); return port; } };
public void run() { Cache cache = getCache(); RegionFactory rf = new RegionFactory(); rf.setEnableOffHeapMemory(isOffHeapEnabled()); rf.setDataPolicy(DataPolicy.PARTITION); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setRedundantCopies(1); paf.setTotalNumBuckets(5); rf.setPartitionAttributes(paf.create()); rf.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(1)); rf.setConcurrencyChecksEnabled(false); rf.create(name); } });
public void run() { Cache cache = getCache(); RegionFactory rf = new RegionFactory(); rf.setEnableOffHeapMemory(isOffHeapEnabled()); rf.setDataPolicy(DataPolicy.PARTITION); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setRedundantCopies(1); paf.setTotalNumBuckets(5); paf.setLocalMaxMemory(0); rf.setPartitionAttributes(paf.create()); rf.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(1)); rf.setConcurrencyChecksEnabled(false); if(allContent) { // rf.initCacheListeners(new CacheListener [] { new MyListener()}); rf.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); } rf.create(name); } });
public void testBug45749part2() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(PARTITION_REDUNDANT); factory.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(5).setRedundantCopies(2).create()); r1 = factory.create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(DataPolicy.PARTITION, ra.getDataPolicy()); assertNotNull(ra.getPartitionAttributes()); assertEquals(5, ra.getPartitionAttributes().getTotalNumBuckets()); assertEquals(2, ra.getPartitionAttributes().getRedundantCopies()); } finally { cleanUpRegion(r1); } }