use of org.apache.geode.internal.cache.DiskStoreImpl in project geode by apache.
the class RegionMBeanBridge method getInstance.
public static <K, V> RegionMBeanBridge<K, V> getInstance(Region<K, V> region) {
if (region.getAttributes().getPartitionAttributes() != null) {
RegionMBeanBridge<K, V> bridge = PartitionedRegionBridge.getInstance(region);
PartitionedRegion parRegion = ((PartitionedRegion) region);
DiskStoreImpl dsi = parRegion.getDiskStore();
if (dsi != null) {
DiskRegionStats stats = parRegion.getDiskRegionStats();
DiskRegionBridge diskRegionBridge = new DiskRegionBridge(stats);
bridge.addDiskRegionBridge(diskRegionBridge);
for (DirectoryHolder dh : dsi.getDirectoryHolders()) {
diskRegionBridge.addDirectoryStats(dh.getDiskDirectoryStats());
}
bridge.addDiskRegionBridge(diskRegionBridge);
}
return bridge;
} else {
RegionMBeanBridge<K, V> bridge = new RegionMBeanBridge<K, V>(region);
LocalRegion localRegion = ((LocalRegion) region);
DiskStoreImpl dsi = localRegion.getDiskStore();
if (dsi != null) {
DiskRegionBridge diskRegionBridge = new DiskRegionBridge(localRegion.getDiskRegion().getStats());
bridge.addDiskRegionBridge(diskRegionBridge);
for (DirectoryHolder dh : dsi.getDirectoryHolders()) {
diskRegionBridge.addDirectoryStats(dh.getDiskDirectoryStats());
}
}
return bridge;
}
}
use of org.apache.geode.internal.cache.DiskStoreImpl in project geode by apache.
the class MemberMBeanBridge method removeDiskStore.
public void removeDiskStore(DiskStore dsi) {
DiskStoreImpl impl = (DiskStoreImpl) dsi;
removeDiskStoreStats(impl.getStats());
}
use of org.apache.geode.internal.cache.DiskStoreImpl in project geode by apache.
the class BackupManager method cleanup.
private void cleanup() {
isCancelled = true;
allowDestroys.countDown();
Collection<DiskStore> diskStores = cache.listDiskStoresIncludingRegionOwned();
for (DiskStore store : diskStores) {
((DiskStoreImpl) store).releaseBackupLock();
}
final DM distributionManager = cache.getInternalDistributedSystem().getDistributionManager();
distributionManager.removeAllMembershipListener(this);
cache.clearBackupManager();
}
use of org.apache.geode.internal.cache.DiskStoreImpl in project geode by apache.
the class ListDiskStoresFunctionJUnitTest method testExecute.
@Test
@SuppressWarnings("unchecked")
public void testExecute() throws Throwable {
final UUID mockDiskStoreOneId = UUID.randomUUID();
final UUID mockDiskStoreTwoId = UUID.randomUUID();
final UUID mockDiskStoreThreeId = UUID.randomUUID();
final String memberId = "mockMemberId";
final String memberName = "mockMemberName";
final InternalCache mockCache = mockContext.mock(InternalCache.class, "Cache");
final InternalDistributedMember mockMember = mockContext.mock(InternalDistributedMember.class, "DistributedMember");
final DiskStoreImpl mockDiskStoreOne = mockContext.mock(DiskStoreImpl.class, "DiskStoreOne");
final DiskStoreImpl mockDiskStoreTwo = mockContext.mock(DiskStoreImpl.class, "DiskStoreTwo");
final DiskStoreImpl mockDiskStoreThree = mockContext.mock(DiskStoreImpl.class, "DiskStoreThree");
final Collection<DiskStoreImpl> mockDiskStores = new ArrayList<DiskStoreImpl>();
mockDiskStores.add(mockDiskStoreOne);
mockDiskStores.add(mockDiskStoreTwo);
mockDiskStores.add(mockDiskStoreThree);
final FunctionContext mockFunctionContext = mockContext.mock(FunctionContext.class, "FunctionContext");
final TestResultSender testResultSender = new TestResultSender();
mockContext.checking(new Expectations() {
{
oneOf(mockCache).getMyId();
will(returnValue(mockMember));
oneOf(mockCache).listDiskStoresIncludingRegionOwned();
will(returnValue(mockDiskStores));
exactly(3).of(mockMember).getId();
will(returnValue(memberId));
exactly(3).of(mockMember).getName();
will(returnValue(memberName));
oneOf(mockDiskStoreOne).getDiskStoreUUID();
will(returnValue(mockDiskStoreOneId));
oneOf(mockDiskStoreOne).getName();
will(returnValue("ds-backup"));
oneOf(mockDiskStoreTwo).getDiskStoreUUID();
will(returnValue(mockDiskStoreTwoId));
oneOf(mockDiskStoreTwo).getName();
will(returnValue("ds-overflow"));
oneOf(mockDiskStoreThree).getDiskStoreUUID();
will(returnValue(mockDiskStoreThreeId));
oneOf(mockDiskStoreThree).getName();
will(returnValue("ds-persistence"));
oneOf(mockFunctionContext).getResultSender();
will(returnValue(testResultSender));
}
});
final ListDiskStoresFunction function = createListDiskStoresFunction(mockCache);
function.execute(mockFunctionContext);
final List<?> results = testResultSender.getResults();
assertNotNull(results);
assertEquals(1, results.size());
final Set<DiskStoreDetails> diskStoreDetails = (Set<DiskStoreDetails>) results.get(0);
assertNotNull(diskStoreDetails);
assertEquals(3, diskStoreDetails.size());
diskStoreDetails.containsAll(Arrays.asList(createDiskStoreDetails(mockDiskStoreOneId, "ds-backup", memberId, memberName), createDiskStoreDetails(mockDiskStoreTwoId, "ds-overflow", memberId, memberName), createDiskStoreDetails(mockDiskStoreThreeId, "ds-persistence", memberId, memberName)));
}
use of org.apache.geode.internal.cache.DiskStoreImpl in project geode by apache.
the class MemberMBeanBridge method addDiskStore.
public void addDiskStore(DiskStore dsi) {
DiskStoreImpl impl = (DiskStoreImpl) dsi;
addDiskStoreStats(impl.getStats());
}
Aggregations