/** * Returns the named disk store factory as a string. For use only by {@link * DiskStoreHelper#diskStoreFactoryToString(String, DiskStoreFactory)}. */ protected static synchronized String diskStoreFactoryToString( String diskStoreName, DiskStoreFactory f) { DiskStore da = ((DiskStoreFactoryImpl)f).getDiskStoreAttributes(); return diskStoreToString(diskStoreName, da); }
public DiskStoreFactoryImpl(Cache cache, DiskStoreAttributes attrs) { this.attrs.name = attrs.name; setAutoCompact(attrs.getAutoCompact()); setAllowForceCompaction(attrs.getAllowForceCompaction()); setCompactionThreshold(attrs.getCompactionThreshold()); setMaxOplogSizeInBytes(attrs.getMaxOplogSizeInBytes()); setTimeInterval(attrs.getTimeInterval()); setWriteBufferSize(attrs.getWriteBufferSize()); setQueueSize(attrs.getQueueSize()); setDiskDirs(cloneArray(attrs.getDiskDirs())); setDiskDirsAndSizes(cloneArray(attrs.getDiskDirs()), cloneArray(attrs.getDiskDirSizes())); setDiskUsageWarningPercentage(attrs.getDiskUsageWarningPercentage()); setDiskUsageCriticalPercentage(attrs.getDiskUsageCriticalPercentage()); this.cache = cache; }
/** * create diskstore factory * * @since prPersistSprint2 */ public DiskStoreFactory createDiskStoreFactory() { return new DiskStoreFactoryImpl(this); }
public DiskStoreFactory setDiskDirs(File[] diskDirs) { checkIfDirectoriesExist(diskDirs); int[] diskSizes = new int[diskDirs.length]; Arrays.fill(diskSizes, DEFAULT_DISK_DIR_SIZE); return setDiskDirsAndSizes(diskDirs, diskSizes); }
public DiskStoreFactory setDiskDirsAndSizes(File[] diskDirs,int[] diskDirSizes) { checkIfDirectoriesExist(diskDirs); if (diskDirSizes.length != diskDirs.length) { throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_NUMBER_OF_DISKSIZES_IS_0_WHICH_IS_NOT_EQUAL_TO_NUMBER_OF_DISK_DIRS_WHICH_IS_1.toLocalizedString(new Object[] {Integer.valueOf(diskDirSizes.length), Integer.valueOf(diskDirs.length)})); } checkIfDirectoriesExist(diskDirs); verifyNonNegativeDirSize(diskDirSizes); this.attrs.diskDirs = new File[diskDirs.length]; System.arraycopy(diskDirs, 0, this.attrs.diskDirs, 0, diskDirs.length); this.attrs.diskDirSizes = new int[diskDirSizes.length]; System.arraycopy(diskDirSizes, 0, this.attrs.diskDirSizes, 0, diskDirSizes.length); return this; }
public DiskStoreFactoryImpl(Cache cache, DiskStoreAttributes attrs) { this.attrs.name = attrs.name; setAutoCompact(attrs.getAutoCompact()); setAllowForceCompaction(attrs.getAllowForceCompaction()); setCompactionThreshold(attrs.getCompactionThreshold()); setMaxOplogSizeInBytes(attrs.getMaxOplogSizeInBytes()); setTimeInterval(attrs.getTimeInterval()); setWriteBufferSize(attrs.getWriteBufferSize()); setQueueSize(attrs.getQueueSize()); setDiskDirs(cloneArray(attrs.getDiskDirs())); setDiskDirsAndSizes(cloneArray(attrs.getDiskDirs()), cloneArray(attrs.getDiskDirSizes())); setSyncWrites(attrs.getSyncWrites()); this.cache = cache; }
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; }
((DiskStoreFactoryImpl)dsf).setMaxOplogSizeInBytes(200000000); dsf.setDiskDirs(dirs); factory.setDiskStoreName(dsf.create("perfTestRegion").getName());
/** * Checks if directories exist * * @param disk_dirs */ private void checkIfDirectoriesExist(File[] disk_dirs) { // for (int i=0; i < disk_dirs.length; i++) { // if (! disk_dirs[i].isDirectory()) { //// throw new IllegalArgumentException(LocalizedStrings.DiskStoreAttributesCreation_0_WAS_NOT_AN_EXISTING_DIRECTORY_FOR_DISKSTORE_1.toLocalizedString(new Object[] {disk_dirs[i], name})); // if (!diskDirs[i].mkdirs()) { // throw new RuntimeException("Cannot create directory" + diskDirs[i].getAbsolutePath() + "Num disk dirs to be created : " + disk_dirs.length + " Dir Name " + disk_dirs[i].getName()); // } // } // } DiskStoreFactoryImpl.checkIfDirectoriesExist(disk_dirs); }
return dsfi.createOwnedByRegion(getFullPath().replace('/', '_'), ra.getPartitionAttributes() != null, internalRegionArgs);
((DiskStoreFactoryImpl)dsf).setMaxOplogSizeInBytes(100000000L * 1024L * 1024L * 1024L); dsf.setAutoCompact(false); File dir = new File("testingDirectoryDefault");
public DiskStoreFactory setDiskDirsAndSizes(File[] diskDirs,int[] diskDirSizes) { if (diskDirSizes.length != diskDirs.length) { throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_NUMBER_OF_DISKSIZES_IS_0_WHICH_IS_NOT_EQUAL_TO_NUMBER_OF_DISK_DIRS_WHICH_IS_1.toLocalizedString(new Object[] {Integer.valueOf(diskDirSizes.length), Integer.valueOf(diskDirs.length)})); } verifyNonNegativeDirSize(diskDirSizes); checkIfDirectoriesExist(diskDirs); this.attrs.diskDirs = new File[diskDirs.length]; System.arraycopy(diskDirs, 0, this.attrs.diskDirs, 0, diskDirs.length); this.attrs.diskDirSizes = new int[diskDirSizes.length]; System.arraycopy(diskDirSizes, 0, this.attrs.diskDirSizes, 0, diskDirSizes.length); return this; }
public DiskStoreFactory setDiskDirs(File[] diskDirs) { checkIfDirectoriesExist(diskDirs); int[] diskSizes = new int[diskDirs.length]; Arrays.fill(diskSizes, DEFAULT_DISK_DIR_SIZE); return setDiskDirsAndSizes(diskDirs, diskSizes); }
/** * Sets the directories with * the default size of 10240 MB to which the region's data is written * * @throws GemFireIOException if a directory does not exist * * @since 3.2 * @deprecated as of 6.5 use {@link DiskStoreFactory#setDiskDirs} instead */ @Deprecated public void setDiskDirs(File[] diskDirs) { if (this.regionAttributes.getDiskStoreName() != null) { throw new IllegalStateException(LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1 .toLocalizedString(new Object[] {"setDiskDirs", this.regionAttributes.getDiskStoreName()})); } DiskStoreFactoryImpl.checkIfDirectoriesExist(diskDirs); this.regionAttributes.diskDirs = diskDirs; this.regionAttributes.diskSizes = new int[diskDirs.length]; for (int i=0; i < diskDirs.length; i++) { this.regionAttributes.diskSizes[i] = DiskStoreFactory.DEFAULT_DISK_DIR_SIZE; } if (!this.regionAttributes.hasDiskWriteAttributes() && !this.regionAttributes.hasDiskSynchronous()) { // switch to the old default this.regionAttributes.diskSynchronous = false; this.regionAttributes.diskWriteAttributes = DiskWriteAttributesImpl.getDefaultAsyncInstance(); } this.regionAttributes.setHasDiskDirs(true); }
return dsfi.createOwnedByRegion(getFullPath().replace('/', '_'), this instanceof PartitionedRegion, internalRegionArgs);
((DiskStoreFactoryImpl) dsf).getDiskStoreAttributes(), false, null, true, upgradeVersionOnly, offlineValidate, offlineCompacting, needsOplogs);
((DiskStoreFactoryImpl)dsf).setMaxOplogSizeInBytes(10000); File dir = new File("testingDirectoryDefault"); dir.mkdir();
/** * Sets the directories to which the region's data is written and also set their sizes in megabytes * * @throws IllegalArgumentException if a dir does not exist or the length of the size array * does not match to the length of the dir array or the given length is not a valid positive number * * @since 5.1 * @deprecated as of 6.5 use {@link DiskStoreFactory#setDiskDirsAndSizes} instead */ @Deprecated public void setDiskDirsAndSizes(File[] diskDirs,int[] diskSizes) { if (this.regionAttributes.getDiskStoreName() != null) { throw new IllegalStateException(LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1 .toLocalizedString(new Object[] {"setDiskDirsAndSizes", this.regionAttributes.getDiskStoreName()})); } DiskStoreFactoryImpl.checkIfDirectoriesExist(diskDirs); this.regionAttributes.diskDirs = diskDirs; if(diskSizes.length != this.regionAttributes.diskDirs.length) { throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_NUMBER_OF_DISKSIZES_IS_0_WHICH_IS_NOT_EQUAL_TO_NUMBER_OF_DISK_DIRS_WHICH_IS_1.toLocalizedString(new Object[] {Integer.valueOf(diskSizes.length), Integer.valueOf(diskDirs.length)})); } DiskStoreFactoryImpl.verifyNonNegativeDirSize(diskSizes); this.regionAttributes.diskSizes = diskSizes; if (!this.regionAttributes.hasDiskWriteAttributes() && !this.regionAttributes.hasDiskSynchronous()) { // switch to the old default this.regionAttributes.diskSynchronous = false; this.regionAttributes.diskWriteAttributes = DiskWriteAttributesImpl.getDefaultAsyncInstance(); } this.regionAttributes.setHasDiskDirs(true); }
/** * create diskstore factory with default attributes * * @since prPersistSprint2 */ public DiskStoreFactory createDiskStoreFactory() { return new DiskStoreFactoryImpl(this); }
/** * Sets the directories with * the default size of 10240 MB to which the region's data is written * * @throws IllegalArgumentException if a directory does not exist * * @since 3.2 * @deprecated as of 6.5 use {@link DiskStoreFactory#setDiskDirs} instead */ @Deprecated public void setDiskDirs(File[] diskDirs) { if (this.regionAttributes.getDiskStoreName() != null) { throw new IllegalStateException(LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1 .toLocalizedString(new Object[] {"setDiskDirs", this.regionAttributes.getDiskStoreName()})); } DiskStoreFactoryImpl.checkIfDirectoriesExist(diskDirs); this.regionAttributes.diskDirs = diskDirs; this.regionAttributes.diskSizes = new int[diskDirs.length]; for (int i=0; i < diskDirs.length; i++) { this.regionAttributes.diskSizes[i] = DiskStoreFactory.DEFAULT_DISK_DIR_SIZE; } if (!this.regionAttributes.hasDiskWriteAttributes() && !this.regionAttributes.hasDiskSynchronous()) { // switch to the old default this.regionAttributes.diskSynchronous = false; this.regionAttributes.diskWriteAttributes = DiskWriteAttributesImpl.getDefaultAsyncInstance(); } this.regionAttributes.setHasDiskDirs(true); }