public ClientRegionFactory<K,V> setDiskSynchronous(boolean isSynchronous) { this.attrsFactory.setDiskSynchronous(isSynchronous); return this; }
public ClientRegionFactory<K,V> setDiskSynchronous(boolean isSynchronous) { this.attrsFactory.setDiskSynchronous(isSynchronous); return this; }
/** * Sets whether or not the writing to the disk is synchronous. * * @param isSynchronous * boolean if true indicates synchronous writes * @return a reference to this RegionFactory object * @since 6.5 */ public RegionFactory<K,V> setDiskSynchronous(boolean isSynchronous) { this.attrsFactory.setDiskSynchronous(isSynchronous); return this; }
/** * Sets whether or not the writing to the disk is synchronous. * * @param isSynchronous * boolean if true indicates synchronous writes * @return a reference to this RegionFactory object * @since 6.5 */ public RegionFactory<K,V> setDiskSynchronous(boolean isSynchronous) { this.attrsFactory.setDiskSynchronous(isSynchronous); return this; }
private void connect() throws CacheException { // Cache c = null; Properties cfg = new Properties(); cfg.setProperty("mcast-port", "0"); cfg.setProperty("locators", ""); cfg.setProperty("statistic-sampling-enabled", "false"); this.ds = DistributedSystem.connect(cfg); this.c = CacheFactory.create(ds); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); factory.setDiskSynchronous(true); factory.setDiskStoreName(this.c.createDiskStoreFactory() .create("DiskInstantiatorsTest") .getName()); this.r = this.c.createRegion("DiskInstantiatorsTest", factory.create()); }
public static void createRegionOnServer1() throws Exception { new Bug37241DUnitTest("temp").createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.GLOBAL); factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); File[] dirs = new File[2]; File file1 = new File("server1_disk1"); File file2 = new File("server1_disk2"); file1.mkdir(); file2.mkdir(); dirs[0] = file1; dirs[1] = file2; factory.setDiskSynchronous(false); factory.setDiskStoreName(cache.createDiskStoreFactory() .setDiskDirs(dirs) .create("Bug37241DUnitTest") .getName()); RegionAttributes attrs = factory.create(); cache.createRegion(REGION_NAME, attrs); }
protected RegionAttributes getRegionAttributes() { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_NO_ACK); File[] diskDirs = new File[1]; diskDirs[0] = new File("diskRegionDirs/" + ProcessMgr.getProcessId()); diskDirs[0].mkdirs(); factory.setDiskStoreName(getCache().createDiskStoreFactory() .setDiskDirs(diskDirs) .setTimeInterval(1000) .setQueueSize(0) .create("DiskDistributedNoAckAsyncRegionTest") .getName()); factory.setDiskSynchronous(false); factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); return factory.create(); }
protected RegionAttributes getRegionAttributes() { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_NO_ACK); File[] diskDirs = new File[1]; diskDirs[0] = new File("diskRegionDirs/" + ProcessMgr.getProcessId()); diskDirs[0].mkdirs(); factory.setDiskStoreName(getCache().createDiskStoreFactory() .setDiskDirs(diskDirs) .create("DiskDistributedNoAckSyncOverflowRegionTest") .getName()); factory.setEvictionAttributes(EvictionAttributes .createLRUMemoryAttributes(1, null, EvictionAction.OVERFLOW_TO_DISK)); factory.setDiskSynchronous(true); factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); return factory.create(); }
public void run2() { try { (new Bug39079DUnitTest("vm1_diskReg")) .getSystem(); assertTrue("cache found null", getCache() != null); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); factory.setDiskSynchronous(false); factory.setDiskStoreName(getCache().createDiskStoreFactory() .setDiskDirs(dirs) .create("Bug39079DUnitTest") .getName()); RegionAttributes attr = factory.create(); getCache().createRegion(regionName, attr); } catch (Exception ex) { ex.printStackTrace(); fail("Error Creating cache / region " + ex); } } };
public static void createCacheForVM0(){ try{ ds = (new DiskRegByteArrayDUnitTest("vm0_diskReg")).getSystem(props); cache = CacheFactory.create(ds); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); factory.setDiskSynchronous(false); factory.setDiskStoreName(cache.createDiskStoreFactory() .setDiskDirs(dirs) .create("DiskRegByteArrayDUnitTest") .getName()); RegionAttributes attr = factory.create(); region = cache.createVMRegion("region", attr); } catch (Exception ex){ ex.printStackTrace(); fail(ex.toString()); } }
public void run2() throws CacheException { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setEarlyAck(false); factory.setEvictionAttributes(EvictionAttributes .createLRUEntryAttributes(100, EvictionAction.OVERFLOW_TO_DISK)); factory.setDataPolicy(DataPolicy.REPLICATE); File d = new File("DiskRegions" + ProcessMgr.getProcessId()); d.mkdirs(); DiskStoreFactory dsf = getCache().createDiskStoreFactory(); dsf.setDiskDirs(new File[]{d}); factory.setDiskSynchronous(true); DiskStore ds = dsf.create(name); factory.setDiskStoreName(ds.getName()); createRegion(name, factory.create()); } };
public static void createCacheForVM1(){ try{ ds = (new DiskRegByteArrayDUnitTest("vm1_diskReg")).getSystem(props); cache = CacheFactory.create(ds); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); factory.setDiskSynchronous(false); factory.setDiskStoreName(cache.createDiskStoreFactory() .setDiskDirs(dirs) .create("DiskRegByteArrayDUnitTest") .getName()); RegionAttributes attr = factory.create(); region = cache.createVMRegion("region", attr); } catch (Exception ex){ ex.printStackTrace(); fail(ex.toString()); } } /*
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()); } });
protected RegionAttributes getRegionAttributes() { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_NO_ACK); File[] diskDirs = new File[1]; diskDirs[0] = new File("diskRegionDirs/" + ProcessMgr.getProcessId()); diskDirs[0].mkdirs(); factory.setDiskStoreName(getCache().createDiskStoreFactory() .setDiskDirs(diskDirs) .setTimeInterval(1000) .setQueueSize(0) .create("DiskDistributedNoAckAsyncOverflowRegionTest") .getName()); factory.setEvictionAttributes(EvictionAttributes .createLRUMemoryAttributes(1, null, EvictionAction.OVERFLOW_TO_DISK)); factory.setDiskSynchronous(false); factory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); return factory.create(); } }
public void run2() throws CacheException { AttributesFactory factory = new AttributesFactory(); 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.setDiskStoreName(getCache().createDiskStoreFactory() .setDiskDirs(diskDirs) .create("LRUEvictionControllerTest") .getName()); factory.setDiskSynchronous(true); factory.setScope(Scope.DISTRIBUTED_ACK); RegionAttributes a = factory.create(); createRegion(r1, a); createRegion(r2, a); createRegion(r3, a); } };
public void run2() { final AttributesFactory factory = new AttributesFactory(); factory.setEnableOffHeapMemory(false); factory.setPartitionAttributes(new PartitionAttributesFactory() .setRedundantCopies(redundantCopies).create()); factory.setDiskSynchronous(true); factory.setCustomEvictionAttributes(criteria, start, interval); final PartitionedRegion pr = (PartitionedRegion)getCache().createRegionFactory(factory.create()).create(name); assertNotNull(pr); } };
private Region createSnappySpecificGlobalCmdRegion(boolean isLead) throws IOException, ClassNotFoundException { GemFireCacheImpl cache = Misc.getGemFireCache(); final com.gemstone.gemfire.cache.AttributesFactory<?, ?> afact = new com.gemstone.gemfire.cache.AttributesFactory<>(); afact.setScope(Scope.DISTRIBUTED_ACK); if (!isLead) { afact.setInitialCapacity(1000); afact.setConcurrencyChecksEnabled(false); afact.setDiskSynchronous(true); afact.setDiskStoreName(GfxdConstants.GFXD_DD_DISKSTORE_NAME); afact.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); // overflow this region to disk as much as possible since we don't // need it to be in memory afact.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes( 1, EvictionAction.OVERFLOW_TO_DISK)); } else { afact.setDataPolicy(DataPolicy.REPLICATE); } InternalRegionArguments internalRegionArgs = new InternalRegionArguments(); return cache.createVMRegion("__snappyglobalcmds__", afact.create(), internalRegionArgs); }
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()); } });
protected RegionAttributes getPersistentPRAttributes(final int redundancy, final int recoveryDelay, Cache cache, int numBuckets, boolean synchronous) { DiskStore ds = cache.findDiskStore("disk"); if(ds == null) { ds = cache.createDiskStoreFactory() .setDiskDirs(getDiskDirs()).create("disk"); } AttributesFactory af = new AttributesFactory(); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setRedundantCopies(redundancy); paf.setRecoveryDelay(recoveryDelay); paf.setTotalNumBuckets(numBuckets); //Make sure all vms end up with the same local max memory paf.setLocalMaxMemory(500); af.setPartitionAttributes(paf.create()); af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION); af.setDiskStoreName("disk"); af.setDiskSynchronous(synchronous); RegionAttributes attr = af.create(); return attr; }
public void run() { Cache cache = getCache(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); DiskStore ds1 = dsf.setDiskDirs(getDiskDirs()) .create(getUniqueName()); AttributesFactory attr = new AttributesFactory(); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setRedundantCopies(1); paf.setRecoveryDelay(-1); paf.setStartupRecoveryDelay(-1); PartitionAttributes prAttr = paf.create(); attr.setPartitionAttributes(prAttr); attr.setDataPolicy(DataPolicy.PERSISTENT_PARTITION); attr.setDiskSynchronous(true); attr.setDiskStoreName(getUniqueName()); cache.createRegion("region1", attr.create()); } };