/** * Sets the directories to which the region's data are written. If multiple * directories are used, GemFire will attempt to distribute the data evenly * amongst them. * * @return a reference to this RegionFactory object * @throws GemfireIOException if a directory cannot be created * * @see AttributesFactory#setDiskDirs * @deprecated as of 6.5 use {@link DiskStoreFactory#setDiskDirs} instead */ @Deprecated public RegionFactory<K,V> setDiskDirs(File[] diskDirs) { this.attrsFactory.setDiskDirs(diskDirs); return this; }
factory.setDiskDirs(new File[] {new File("").getAbsoluteFile()}); RegionAttributes attrs = factory.create(); assertEquals(false, attrs.getDiskWriteAttributes().isSynchronous());
/** * Sets the directories to which the region's data are written. If multiple * directories are used, GemFire will attempt to distribute the data evenly * amongst them. * * @return a reference to this RegionFactory object * @throws IllegalArgumentException if a directory does not exist * * @see AttributesFactory#setDiskDirs * @deprecated as of 6.5 use {@link DiskStoreFactory#setDiskDirs} instead */ @Deprecated public RegionFactory<K,V> setDiskDirs(File[] diskDirs) { this.attrsFactory.setDiskDirs(diskDirs); return this; }
dirs[0] = new File(diskDir); factory.setDiskDirs(dirs); dirs[0] = new File(diskDir); factory.setDiskDirs(dirs);
public void run() { Cache cache = getCache(); ResourceManager manager = cache.getResourceManager(); manager.setCriticalHeapPercentage(95); manager.setEvictionHeapPercentage(90); AttributesFactory<Integer, TestDelta> attr = new AttributesFactory<Integer, TestDelta>(); attr.setEvictionAttributes(EvictionAttributes.createLRUHeapAttributes( new TestObjectSizer(), EvictionAction.OVERFLOW_TO_DISK)); attr.setDiskDirs(getMyDiskDirs()); attr.setDataPolicy(DataPolicy.REPLICATE); attr.setScope(Scope.DISTRIBUTED_ACK); attr.setDiskDirs(getMyDiskDirs()); Region region = cache.createRegion("region", attr.create()); } });
factory.setDiskDirs(persistenceDirs);
public void run2() throws CacheException { AttributesFactory factory = new AttributesFactory(); factory.setEnableOffHeapMemory(isOffHeapEnabled()); factory.setEvictionAttributes( EvictionAttributes.createLRUEntryAttributes(maxEntries, EvictionAction.OVERFLOW_TO_DISK)); factory.setDataPolicy(DataPolicy.REPLICATE); File[] diskDirs = new File[1]; diskDirs[0] = new File("overflowDir/" + OSProcess.getId()); diskDirs[0].mkdirs(); factory.setDiskDirs(diskDirs); DiskWriteAttributesFactory dwaf = new DiskWriteAttributesFactory(); dwaf.setSynchronous(true); DiskWriteAttributes dwattrs = dwaf.create(); factory.setDiskWriteAttributes(dwattrs); factory.setDiskDirs(diskDirs); factory.setScope(Scope.DISTRIBUTED_ACK); RegionAttributes a = factory.create(); createRegion(r1, a); createRegion(r2, a); createRegion(r3, a); } };
try { AttributesFactory factory = new AttributesFactory(); factory.setDiskDirs(dirs2); factory.setDiskStoreName(getUniqueName()); RegionAttributes ra = factory.create(); AttributesFactory factory = new AttributesFactory(); factory.setDiskStoreName(getUniqueName()); factory.setDiskDirs(dirs2); RegionAttributes ra = factory.create(); } catch (IllegalStateException e) {
public void run() { Cache cache = getCache(); AttributesFactory<Integer, TestDelta> attr = new AttributesFactory<Integer, TestDelta>(); attr.setDiskSynchronous(true); attr.setDataPolicy(DataPolicy.REPLICATE); attr.setScope(Scope.DISTRIBUTED_ACK); attr.setEvictionAttributes(EvictionAttributes.createLRUMemoryAttributes(1, new TestObjectSizer(), EvictionAction.OVERFLOW_TO_DISK)); attr.setDiskDirs(getMyDiskDirs()); Region region = cache.createRegion("region", attr.create()); } });
@Override protected RegionAttributes getPersistentPRAttributes( final int redundancy, final int recoveryDelay, Cache cache, int numBuckets, boolean synchronous) { AttributesFactory af = new AttributesFactory(); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setRedundantCopies(redundancy); paf.setRecoveryDelay(recoveryDelay); paf.setTotalNumBuckets(numBuckets); af.setPartitionAttributes(paf.create()); af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION); af.setDiskDirs(getDiskDirs()); RegionAttributes attr = af.create(); return attr; } }
try { AttributesFactory af = new AttributesFactory(); af.setDiskDirs(new File[]{f1, f2}); af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); Region r = cache.createRegion("r", af.create()); af.setDiskDirs(new File[]{f1, f2}); af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION); r = cache.createRegion("r", af.create());
public void run() { Cache cache = getCache(); AttributesFactory<Integer, TestDelta> attr = new AttributesFactory<Integer, TestDelta>(); attr.setDiskSynchronous(true); PartitionAttributesFactory<Integer, TestDelta> paf = new PartitionAttributesFactory<Integer, TestDelta>(); paf.setRedundantCopies(1); if(enableLRU) { paf.setLocalMaxMemory(1); // memlru limit is 1 megabyte attr.setEvictionAttributes(EvictionAttributes.createLRUMemoryAttributes(new TestObjectSizer(), EvictionAction.OVERFLOW_TO_DISK)); attr.setDiskDirs(getMyDiskDirs()); } PartitionAttributes<Integer, TestDelta> prAttr = paf.create(); attr.setPartitionAttributes(prAttr); attr.setDataPolicy(DataPolicy.PARTITION); attr.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); Region<Integer, TestDelta> region = cache.createRegion("region", attr.create()); } });
factory.setDiskDirs(getDiskDirFileArr());
public void run2() throws CacheException { Cache cache = getCache(); AttributesFactory factory = new AttributesFactory(); factory.setCacheListener(new CacheListener2()); factory.setCacheLoader(new CacheLoader2()); factory.setCacheWriter(new CacheWriter2()); factory.setConcurrencyLevel(concurrencyLevel); factory.setDiskDirs(new File[] { diskDir }); factory.setDiskWriteAttributes(dwa); factory.setStatisticsEnabled(statisticsEnabled); factory.setEntryIdleTimeout(entryIdle); factory.setEntryTimeToLive(entryTtl); factory.setInitialCapacity(initialCapacity); factory.setKeyConstraint(String.class); factory.setLoadFactor(loadFactor); factory.setDataPolicy(dataPolicy); factory.setRegionIdleTimeout(regionIdle); factory.setRegionTimeToLive(regionTtl); factory.setScope(scope); factory.setEarlyAck(false); MembershipAttributes membershipAttributes = new MembershipAttributes(new String[] {"A"}, LossAction.LIMITED_ACCESS, ResumptionAction.NONE); factory.setMembershipAttributes(membershipAttributes); RegionAttributes attrs = factory.create(); Region region = cache.createRegion(name, attrs); region.setUserAttribute(userAttribute); } });
af.setDiskWriteAttributes(new DiskWriteAttributesFactory().create()); if (this.config.getDiskDir() != null) { af.setDiskDirs(new File[]{this.config.getDiskDir()});
af.setDiskWriteAttributes(new DiskWriteAttributesFactory().create()); if (this.config.getDiskDir() != null) { af.setDiskDirs(new File[]{this.config.getDiskDir()});
factory.setDiskDirs(dirs1); fail("Should have thrown an IllegalStateException"); } catch (Exception ex) { factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); File[] dirs2 = new File[] {new File("").getAbsoluteFile()}; factory.setDiskDirs(dirs2); try { factory.setDiskStoreName("ds1");