public void run() { try { RegionFactory f = getCache().createRegionFactory(getRegionAttributes()); f.setDiskSynchronous(syncDiskWrite); CCRegion = (LocalRegion)f.create(name); } catch (CacheException ex) { fail("While creating region", ex); } } };
public void run() { final Cache cache = getCache(); DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory(); diskStoreFactory.setDiskDirs(new File[] { diskStoreDir }); final DiskStore diskStore1 = diskStoreFactory.create(diskStoreName1); assertNotNull(diskStore1); RegionFactory regionFactory = cache .createRegionFactory(RegionShortcut.REPLICATE_PERSISTENT); regionFactory.setDiskStoreName(diskStoreName1); regionFactory.setDiskSynchronous(true); regionFactory.create(region1); regionFactory.create(region2); cache.close(); assertTrue(new File(diskStoreDir, "BACKUP" + diskStoreName1 + ".if") .exists()); } });
public void run() { Cache cache = getCache(); RegionFactory regionFactory = cache.createRegionFactory(); regionFactory.setDiskStoreName(regionName); regionFactory.setDiskSynchronous(true); regionFactory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); regionFactory.setScope(Scope.DISTRIBUTED_ACK); regionFactory.create(regionName); } });
public void run() { final Cache cache = getCache(); DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory(); diskStoreFactory.setDiskDirs(new File[] { diskStoreDir }); final DiskStore diskStore1 = diskStoreFactory.create(diskStoreName1); assertNotNull(diskStore1); RegionFactory regionFactory = cache.createRegionFactory(RegionShortcut.REPLICATE_PERSISTENT); regionFactory.setDiskStoreName(diskStoreName1); regionFactory.setDiskSynchronous(true); regionFactory.create(region1); regionFactory.setCompressor(SnappyCompressor.getDefaultInstance()); regionFactory.create(region2); cache.close(); assertTrue(new File(diskStoreDir, "BACKUP" + diskStoreName1 + ".if").exists()); } });
private Region<?,?> createRepRegWithPersistence(String regionName, String diskStoreName, String diskDirName) { Cache cache = getCache(); File diskStoreDirFile = new File(diskDirName); diskStoreDirFile.deleteOnExit(); if (!diskStoreDirFile.exists()) { diskStoreDirFile.mkdirs(); } DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory(); diskStoreFactory.setDiskDirs(new File[] { diskStoreDirFile }); diskStoreFactory.setMaxOplogSize(1); diskStoreFactory.setAllowForceCompaction(true); diskStoreFactory.setAutoCompact(false); diskStoreFactory.create(diskStoreName); /**** * Eviction Attributes */ EvictionAttributes ea = EvictionAttributes.createLRUEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK); RegionFactory regionFactory = cache.createRegionFactory(); regionFactory.setDiskStoreName(diskStoreName); regionFactory.setDiskSynchronous(true); regionFactory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); regionFactory.setEvictionAttributes(ea); return regionFactory.create(regionName); }
private Region<?,?> createParRegWithPersistence(String regionName, String diskStoreName, String diskDirName) { Cache cache = getCache(); File diskStoreDirFile = new File(diskDirName); diskStoreDirFile.deleteOnExit(); if (!diskStoreDirFile.exists()) { diskStoreDirFile.mkdirs(); } DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory(); diskStoreFactory.setDiskDirs(new File[] { diskStoreDirFile }); diskStoreFactory.setMaxOplogSize(1); diskStoreFactory.setAllowForceCompaction(true); diskStoreFactory.setAutoCompact(false); diskStoreFactory.create(diskStoreName); /**** * Eviction Attributes */ EvictionAttributes ea = EvictionAttributes.createLRUEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK); RegionFactory regionFactory = cache.createRegionFactory(); regionFactory.setDiskStoreName(diskStoreName); regionFactory.setDiskSynchronous(true); regionFactory.setDataPolicy(DataPolicy.PERSISTENT_PARTITION); regionFactory.setEvictionAttributes(ea); return regionFactory.create(regionName); }
public void testSetDiskSynchronous() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(LOCAL_PERSISTENT); r1 = factory.setDiskSynchronous(true).create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(true, ra.isDiskSynchronous()); } finally { cleanUpRegion(r1); } } public void testSetPartitionAttributes() throws CacheException, IOException
public void run() { Cache cache = getCache(); File diskStoreDirFile = new File(diskStoreName + vm.getPid()); diskStoreDirFile.mkdirs(); DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory(); diskStoreFactory.setDiskDirs(new File[] { diskStoreDirFile }); diskStoreFactory.setMaxOplogSize(1); diskStoreFactory.setAllowForceCompaction(true); diskStoreFactory.setAutoCompact(false); diskStoreFactory.create(regionName); RegionFactory regionFactory = cache.createRegionFactory(); regionFactory.setDiskStoreName(regionName); regionFactory.setDiskSynchronous(true); regionFactory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); regionFactory.setScope(Scope.DISTRIBUTED_ACK); regionFactory.create(regionName); } });
private Region<?,?> createParRegWithPersistence(String regionName, String diskStoreName, String diskDirName) { Cache cache = getCache(); File diskStoreDirFile = new File(diskDirName); if (!diskStoreDirFile.exists()) { diskStoreDirFile.mkdirs(); } DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory(); diskStoreFactory.setDiskDirs(new File[] { diskStoreDirFile }); diskStoreFactory.setMaxOplogSize(1); diskStoreFactory.setAllowForceCompaction(true); diskStoreFactory.setAutoCompact(false); diskStoreFactory.create(diskStoreName); /**** * Eviction Attributes */ EvictionAttributes ea = EvictionAttributes.createLRUEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK); RegionFactory regionFactory = cache.createRegionFactory(); regionFactory.setDiskStoreName(diskStoreName); regionFactory.setDiskSynchronous(true); regionFactory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); regionFactory.setScope(Scope.DISTRIBUTED_ACK); regionFactory.setEvictionAttributes(ea); return regionFactory.create(regionName); }
public void run() { Cache cache = getCache(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); File dir = getDiskDirForVM(vm); dir.mkdirs(); dsf.setDiskDirs(new File[] {dir}); dsf.setMaxOplogSize(1); DiskStore ds = dsf.create(REGION_NAME); RegionFactory rf = new RegionFactory(); rf.setDiskStoreName(ds.getName()); rf.setDiskSynchronous(diskSynchronous); rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); rf.setScope(Scope.DISTRIBUTED_ACK); rf.create(REGION_NAME); } };
public void run() { Cache cache = getCache(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); File dir = getDiskDirForVM(vm); dir.mkdirs(); dsf.setDiskDirs(new File[] {dir}); dsf.setMaxOplogSize(1); DiskStore ds = dsf.create(REGION_NAME); RegionFactory rf = new RegionFactory(); rf.setDiskStoreName(ds.getName()); rf.setDiskSynchronous(true); rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); rf.setScope(Scope.DISTRIBUTED_ACK); rf.create(REGION_NAME); } };
public void run() { Cache cache = getCache(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); File dir = getDiskDirForVM(vm0); dir.mkdirs(); dsf.setDiskDirs(new File[] {dir}); dsf.setMaxOplogSize(1); dsf.setQueueSize(100); dsf.setTimeInterval(1000); DiskStore ds = dsf.create(REGION_NAME); RegionFactory rf = new RegionFactory(); rf.setDiskStoreName(ds.getName()); rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); rf.setScope(Scope.DISTRIBUTED_ACK); rf.setDiskSynchronous(false); rf.create(REGION_NAME); } };
public void run() { Cache cache = getCache(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); File dir = getDiskDirForVM(vm); dir.mkdirs(); dsf.setDiskDirs(new File[] { dir }); dsf.setMaxOplogSize(1); dsf.setAllowForceCompaction(true); dsf.setAutoCompact(false); DiskStore ds = dsf.create(REGION_NAME); RegionFactory rf = cache.createRegionFactory(); rf.setDiskStoreName(ds.getName()); rf.setDiskSynchronous(true); rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); rf.setScope(Scope.DISTRIBUTED_ACK); rf.create(REGION_NAME); } };
private Region createAsyncRegionWithSmallQueue(final VM vm0) { Cache cache = getCache(); DiskStoreFactoryImpl dsf = (DiskStoreFactoryImpl) cache.createDiskStoreFactory(); File dir = getDiskDirForVM(vm0); dir.mkdirs(); dsf.setDiskDirs(new File[] {dir}); dsf.setMaxOplogSizeInBytes(500); dsf.setQueueSize(1000); dsf.setTimeInterval(1000); DiskStore ds = dsf.create(REGION_NAME); RegionFactory rf = new RegionFactory(); rf.setDiskStoreName(ds.getName()); rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); rf.setScope(Scope.DISTRIBUTED_ACK); rf.setDiskSynchronous(false); Region region = rf.create(REGION_NAME); return region; }
public void run() { Cache cache = getCache(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); File dir = getDiskDirForVM(vm0); dir.mkdirs(); dsf.setDiskDirs(new File[] {dir}); dsf.setMaxOplogSize(1); dsf.setAutoCompact(false); dsf.setAllowForceCompaction(true); dsf.setCompactionThreshold(20); DiskStore ds = dsf.create(REGION_NAME); RegionFactory rf = new RegionFactory(); rf.setDiskStoreName(ds.getName()); rf.setDiskSynchronous(true); rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); rf.setScope(Scope.DISTRIBUTED_ACK); rf.create(REGION_NAME); } };
private LocalRegion createRegion(final VM vm0) { Cache cache = getCache(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); File dir = getDiskDirForVM(vm0); dir.mkdirs(); dsf.setDiskDirs(new File[] {dir}); dsf.setMaxOplogSize(1); //Turn of automatic compaction dsf.setAllowForceCompaction(true); dsf.setAutoCompact(false); //The compaction javadocs seem to be wrong. This //is the amount of live data in the oplog dsf.setCompactionThreshold(40); DiskStore ds = dsf.create(REGION_NAME); RegionFactory rf = new RegionFactory(); rf.setDiskStoreName(ds.getName()); rf.setDiskSynchronous(true); rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); rf.setScope(Scope.DISTRIBUTED_ACK); LocalRegion region = (LocalRegion) rf.create(REGION_NAME); return region; }
public void run() { Cache cache = getCache(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); dsf.setDiskDirs(getDiskDirs(getUniqueName())); dsf.setMaxOplogSize(1); DiskStore ds = dsf.create(getUniqueName()); RegionFactory rf = new RegionFactory(); rf.setDiskStoreName(ds.getName()); rf.setDiskSynchronous(true); rf.setDataPolicy(DataPolicy.REPLICATE); rf.setEvictionAttributes(EvictionAttributes.createLIFOEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK)); rf.create("region3"); } };
factory.setDiskSynchronous(regionCreateArgs.isDiskSynchronous());
public void run() { Cache cache = getCache(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); dsf.setDiskDirs(getDiskDirs(getUniqueName())); dsf.setMaxOplogSize(1); DiskStore ds = dsf.create(getUniqueName()); RegionFactory rf = new RegionFactory(); rf.setDiskStoreName(ds.getName()); rf.setDiskSynchronous(true); rf.setDataPolicy(getDataPolicy()); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setRedundantCopies(0); rf.setPartitionAttributes(paf.create()); rf.create("region1"); dsf = cache.createDiskStoreFactory(); dsf.setDiskDirs(getDiskDirs(getUniqueName()+2)); dsf.setMaxOplogSize(1); ds = dsf.create(getUniqueName()+2); rf.setDiskStoreName(getUniqueName()+2); rf.create("region2"); } };
factory.setDiskSynchronous(regionCreateArgs.isDiskSynchronous());