public static ResultCollector<?, ?> executeFunction(final Function function, Object args,
      final Set<DistributedMember> targetMembers) {
    Execution execution;

    if (args != null) {
      execution = FunctionService.onMembers(targetMembers).setArguments(args);
    } else {
      execution = FunctionService.onMembers(targetMembers);
    }

    ((AbstractExecution) execution).setIgnoreDepartedMembers(true);
    return execution.execute(function);
  }
Executes a function with arguments on a set of members, ignoring the departed members.

@param function Function to be executed.
@param args Arguments passed to the function, pass null if you wish to pass no arguments to the
       function.
@param targetMembers Set of members on which the function is to be executed.
geode-core/src/main/java/org/apache/geode/management/internal/util/ManagementUtils.java