@Override
public void afterPropertiesSet() throws Exception {
Assert.state(cache != null, String.format("A reference to the GemFire Cache must be set for Disk Store '%1$s'.",
getName()));
DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory();
if (allowForceCompaction != null) {
diskStoreFactory.setAllowForceCompaction(allowForceCompaction);
}
if (autoCompact != null) {
diskStoreFactory.setAutoCompact(autoCompact);
}
if (compactionThreshold != null) {
diskStoreFactory.setCompactionThreshold(compactionThreshold);
}
if (diskUsageCriticalPercentage != null) {
diskStoreFactory.setDiskUsageCriticalPercentage(diskUsageCriticalPercentage);
}
if (diskUsageWarningPercentage != null) {
diskStoreFactory.setDiskUsageWarningPercentage(diskUsageWarningPercentage);
}
if (maxOplogSize != null) {
diskStoreFactory.setMaxOplogSize(maxOplogSize);
}
if (queueSize != null) {
diskStoreFactory.setQueueSize(queueSize);
}
if (timeInterval != null) {
diskStoreFactory.setTimeInterval(timeInterval);
}
if (writeBufferSize != null) {
diskStoreFactory.setWriteBufferSize(writeBufferSize);
}
if (!CollectionUtils.isEmpty(diskDirs)) {
File[] diskDirFiles = new File[diskDirs.size()];
int[] diskDirSizes = new int[diskDirs.size()];
for (int index = 0; index < diskDirs.size(); index++) {
DiskDir diskDir = diskDirs.get(index);
diskDirFiles[index] = new File(diskDir.location);
diskDirSizes[index] = (diskDir.maxSize != null ? diskDir.maxSize
: DiskStoreFactory.DEFAULT_DISK_DIR_SIZE);
}
diskStoreFactory.setDiskDirsAndSizes(diskDirFiles, diskDirSizes);
}
diskStore = diskStoreFactory.create(getName());
Assert.notNull(diskStore, String.format("DiskStore with name '%1$s' failed to be created successfully.",
diskStore.getName()));
}