class ScheduleIndexRebuildJob extends VisorJob<CacheScheduleIndexesRebuildCommandArg, ScheduleIndexRebuildJobRes> {
        /** Serial version uid. */
        private static final long serialVersionUID = 0L;

        /**
         * Create job with specified argument.
         *
         * @param arg Job argument.
         * @param debug Flag indicating whether debug information should be printed into node log.
         */
        protected ScheduleIndexRebuildJob(CacheScheduleIndexesRebuildCommandArg arg, boolean debug) {
            super(arg, debug);
        }

        /** {@inheritDoc} */
        @Override protected ScheduleIndexRebuildJobRes run(CacheScheduleIndexesRebuildCommandArg arg) throws IgniteException {<FILL_FUNCTION_BODY>}

        /**
         * @param cache Cache name.
         * @return Indexes of the cache.
         */
        private Set<String> indexes(String cache) {
            return ignite.context().indexProcessor().treeIndexes(cache, false).stream()
                .map(Index::name)
                .collect(Collectors.toSet());
        }
    }

            Set<String> argCacheGrps = arg.groupNames() == null
                ? null
                : new HashSet<>(Arrays.asList(arg.groupNames()));

            assert (arg.cacheToIndexes() != null && !arg.cacheToIndexes().isEmpty())
                || (argCacheGrps != null && !argCacheGrps.isEmpty()) : "Cache to indexes map or cache groups must be specified.";

            Map<String, Set<String>> argCacheToIndexes = arg.cacheToIndexes() != null ? arg.cacheToIndexes() : new HashMap<>();

            Set<String> notFoundCaches = new HashSet<>();
            Set<String> notFoundGrps = new HashSet<>();

            GridCacheProcessor cacheProc = ignite.context().cache();

            Map<String, Set<String>> cacheToIndexes = new HashMap<>();
            Map<String, Set<String>> cacheToMissedIndexes = new HashMap<>();

            if (argCacheGrps != null) {
                argCacheGrps.forEach(groupName -> {
                    CacheGroupContext grpCtx = cacheProc.cacheGroup(CU.cacheId(groupName));

                    if (grpCtx == null) {
                        notFoundGrps.add(groupName);
                        return;
                    }

                    grpCtx.caches().stream().map(GridCacheContext::name).forEach(cache -> {
                        argCacheToIndexes.put(cache, Collections.emptySet());
                    });
                });
            }

            for (Entry<String, Set<String>> indexesByCache : argCacheToIndexes.entrySet()) {
                String cache = indexesByCache.getKey();
                Set<String> indexesArg = indexesByCache.getValue();
                int cacheId = CU.cacheId(cache);

                GridCacheContext<?, ?> cacheCtx = cacheProc.context().cacheContext(cacheId);

                if (cacheCtx == null) {
                    notFoundCaches.add(cache);
                    continue;
                }

                Set<String> existingIndexes = indexes(cache);
                Set<String> indexesToRebuild = cacheToIndexes.computeIfAbsent(cache, s -> new HashSet<>());
                Set<String> missedIndexes = cacheToMissedIndexes.computeIfAbsent(cache, s -> new HashSet<>());

                if (indexesArg.isEmpty())
                    indexesToRebuild.addAll(existingIndexes);
                else {
                    indexesArg.forEach(index -> {
                        if (!existingIndexes.contains(index)) {
                            missedIndexes.add(index);
                            return;
                        }

                        indexesToRebuild.add(index);
                    });
                }
            }

            if (hasAtLeastOneIndex(cacheToIndexes)) {
                MaintenanceRegistry maintenanceRegistry = ignite.context().maintenanceRegistry();

                MaintenanceTask task = toMaintenanceTask(
                    cacheToIndexes.entrySet().stream().collect(Collectors.toMap(
                        (e) -> CU.cacheId(e.getKey()),
                        Entry::getValue
                    ))
                );

                try {
                    maintenanceRegistry.registerMaintenanceTask(
                        task,
                        oldTask -> mergeTasks(oldTask, task)
                    );
                }
                catch (IgniteCheckedException e) {
                    throw new RuntimeException(e);
                }
            }

            return new ScheduleIndexRebuildJobRes(
                cacheToIndexes,
                cacheToMissedIndexes,
                notFoundCaches,
                notFoundGrps
            );
        
<methods>public non-sealed void <init>() ,public Map<? extends org.apache.ignite.compute.ComputeJob,org.apache.ignite.cluster.ClusterNode> map(List<org.apache.ignite.cluster.ClusterNode>, VisorTaskArgument<org.apache.ignite.internal.management.cache.CacheScheduleIndexesRebuildCommandArg>) ,public final org.apache.ignite.internal.management.cache.ScheduleIndexRebuildTaskRes reduce(List<org.apache.ignite.compute.ComputeJobResult>) ,public org.apache.ignite.compute.ComputeJobResultPolicy result(org.apache.ignite.compute.ComputeJobResult, List<org.apache.ignite.compute.ComputeJobResult>) <variables>protected boolean debug,protected transient org.apache.ignite.internal.IgniteEx ignite,protected long start,protected org.apache.ignite.internal.management.cache.CacheScheduleIndexesRebuildCommandArg taskArg