use of org.apache.geode.internal.cache.xmlcache.DiskStoreAttributesCreation in project geode by apache.
the class DiskStoreFactoryImpl method create.
public DiskStore create(String name) {
this.attrs.name = name;
// As a simple fix for 41290, only allow one DiskStore to be created
// at a time per cache by syncing on the cache.
DiskStore result;
synchronized (this.cache) {
result = findExisting(name);
if (result == null) {
if (this.cache instanceof GemFireCacheImpl) {
TypeRegistry registry = this.cache.getPdxRegistry();
DiskStoreImpl dsi = new DiskStoreImpl(this.cache, this.attrs);
result = dsi;
// Added for M&M
this.cache.getInternalDistributedSystem().handleResourceEvent(ResourceEvent.DISKSTORE_CREATE, dsi);
dsi.doInitialRecovery();
this.cache.addDiskStore(dsi);
if (registry != null) {
registry.creatingDiskStore(dsi);
}
} else if (this.cache instanceof CacheCreation) {
CacheCreation creation = (CacheCreation) this.cache;
result = new DiskStoreAttributesCreation(this.attrs);
creation.addDiskStore(result);
}
}
}
// that isn't backed up.
if (this.cache instanceof GemFireCacheImpl) {
BackupManager backup = this.cache.getBackupManager();
if (backup != null) {
backup.waitForBackup();
}
}
return result;
}
use of org.apache.geode.internal.cache.xmlcache.DiskStoreAttributesCreation in project geode by apache.
the class CacheXml80DUnitTest method testDiskUsage.
@Test
public void testDiskUsage() throws Exception {
CacheCreation cache = new CacheCreation();
DiskStoreAttributesCreation disk = new DiskStoreAttributesCreation();
disk.setDiskUsageWarningPercentage(97);
disk.setDiskUsageCriticalPercentage(98);
disk.setName("mydisk");
cache.addDiskStore(disk);
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
attrs.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
attrs.setDiskStoreName("mydisk");
cache.createVMRegion("whatever", attrs);
testXml(cache);
}
Aggregations