Search in sources :

Example 1 with ListIndexFunction

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

the class IndexCommands method getIndexListing.

@SuppressWarnings("unchecked")
protected List<IndexDetails> getIndexListing() {
    final Execution functionExecutor = getMembersFunctionExecutor(getMembers(getCache()));
    if (functionExecutor instanceof AbstractExecution) {
        ((AbstractExecution) functionExecutor).setIgnoreDepartedMembers(true);
    }
    final ResultCollector<?, ?> resultsCollector = functionExecutor.execute(new ListIndexFunction());
    final List<?> results = (List<?>) resultsCollector.getResult();
    final List<IndexDetails> indexDetailsList = new ArrayList<IndexDetails>(results.size());
    for (Object result : results) {
        if (result instanceof Set) {
            // ignore FunctionInvocationTargetExceptions and other Exceptions
            indexDetailsList.addAll((Set<IndexDetails>) result);
        }
    }
    Collections.sort(indexDetailsList);
    return indexDetailsList;
}
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) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Set(java.util.Set) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) IndexDetails(org.apache.geode.management.internal.cli.domain.IndexDetails) ListIndexFunction(org.apache.geode.management.internal.cli.functions.ListIndexFunction)

Aggregations

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