/** * 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); }
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 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 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; }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }