Search in sources :

Example 1 with DiskStoreImpl

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;
    }
}
Also used : DiskRegionStats(org.apache.geode.internal.cache.DiskRegionStats) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) DiskStoreImpl(org.apache.geode.internal.cache.DiskStoreImpl) LocalRegion(org.apache.geode.internal.cache.LocalRegion) DirectoryHolder(org.apache.geode.internal.cache.DirectoryHolder)

Example 2 with DiskStoreImpl

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());
}
Also used : DiskStoreImpl(org.apache.geode.internal.cache.DiskStoreImpl)

Example 3 with DiskStoreImpl

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();
}
Also used : DiskStore(org.apache.geode.cache.DiskStore) DM(org.apache.geode.distributed.internal.DM) DiskStoreImpl(org.apache.geode.internal.cache.DiskStoreImpl)

Example 4 with DiskStoreImpl

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)));
}
Also used : Expectations(org.jmock.Expectations) Set(java.util.Set) ArrayList(java.util.ArrayList) DiskStoreDetails(org.apache.geode.management.internal.cli.domain.DiskStoreDetails) InternalCache(org.apache.geode.internal.cache.InternalCache) FunctionContext(org.apache.geode.cache.execute.FunctionContext) InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) DiskStoreImpl(org.apache.geode.internal.cache.DiskStoreImpl) UUID(java.util.UUID) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 5 with DiskStoreImpl

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());
}
Also used : DiskStoreImpl(org.apache.geode.internal.cache.DiskStoreImpl)

Aggregations

DiskStoreImpl (org.apache.geode.internal.cache.DiskStoreImpl)9 DiskStore (org.apache.geode.cache.DiskStore)4 ArrayList (java.util.ArrayList)3 PersistentID (org.apache.geode.cache.persistence.PersistentID)3 HashSet (java.util.HashSet)2 InternalCache (org.apache.geode.internal.cache.InternalCache)2 File (java.io.File)1 IOException (java.io.IOException)1 Set (java.util.Set)1 UUID (java.util.UUID)1 FunctionContext (org.apache.geode.cache.execute.FunctionContext)1 DM (org.apache.geode.distributed.internal.DM)1 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)1 DirectoryHolder (org.apache.geode.internal.cache.DirectoryHolder)1 DiskRegionStats (org.apache.geode.internal.cache.DiskRegionStats)1 LocalRegion (org.apache.geode.internal.cache.LocalRegion)1 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)1 DiskStoreDetails (org.apache.geode.management.internal.cli.domain.DiskStoreDetails)1 UnitTest (org.apache.geode.test.junit.categories.UnitTest)1 Expectations (org.jmock.Expectations)1