Search in sources :

Example 1 with ListDiskStoresFunction

use of org.apache.geode.management.internal.cli.functions.ListDiskStoresFunction in project geode by apache.

the class DiskStoreCommands method getDiskStoreListing.

@SuppressWarnings("unchecked")
protected List<DiskStoreDetails> getDiskStoreListing(Set<DistributedMember> members) {
    final Execution membersFunctionExecutor = getMembersFunctionExecutor(members);
    if (membersFunctionExecutor instanceof AbstractExecution) {
        ((AbstractExecution) membersFunctionExecutor).setIgnoreDepartedMembers(true);
    }
    final ResultCollector<?, ?> resultCollector = membersFunctionExecutor.execute(new ListDiskStoresFunction());
    final List<?> results = (List<?>) resultCollector.getResult();
    final List<DiskStoreDetails> distributedSystemMemberDiskStores = new ArrayList<DiskStoreDetails>(results.size());
    for (final Object result : results) {
        if (result instanceof Set) {
            // ignore FunctionInvocationTargetExceptions and other
            // Exceptions...
            distributedSystemMemberDiskStores.addAll((Set<DiskStoreDetails>) result);
        }
    }
    Collections.sort(distributedSystemMemberDiskStores);
    return distributedSystemMemberDiskStores;
}
Also used : AbstractExecution(org.apache.geode.internal.cache.execute.AbstractExecution) Execution(org.apache.geode.cache.execute.Execution) AbstractExecution(org.apache.geode.internal.cache.execute.AbstractExecution) ListDiskStoresFunction(org.apache.geode.management.internal.cli.functions.ListDiskStoresFunction) Set(java.util.Set) HashSet(java.util.HashSet) ArrayList(java.util.ArrayList) DiskStoreDetails(org.apache.geode.management.internal.cli.domain.DiskStoreDetails) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 Execution (org.apache.geode.cache.execute.Execution)1 AbstractExecution (org.apache.geode.internal.cache.execute.AbstractExecution)1 DiskStoreDetails (org.apache.geode.management.internal.cli.domain.DiskStoreDetails)1 ListDiskStoresFunction (org.apache.geode.management.internal.cli.functions.ListDiskStoresFunction)1