shishkovilja commented on code in PR #9694:
URL: https://github.com/apache/ignite/pull/9694#discussion_r866761838


##########
modules/core/src/main/java/org/apache/ignite/internal/visor/cache/metrics/VisorCacheMetricsManageTask.java:
##########
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.cache.metrics;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.TreeMap;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.processors.task.GridVisorManagementTask;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+import static 
org.apache.ignite.internal.visor.cache.metrics.CacheMetricsManageSubCommand.ENABLE;
+
+/**
+ * Task for a cache metrics manage command.
+ */
+@GridInternal
+@GridVisorManagementTask
+public class VisorCacheMetricsManageTask extends 
VisorOneNodeTask<VisorCacheMetricsManageTaskArg, 
VisorCacheMetricsManageTaskResult> {
+    /** Serial version uid. */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override protected VisorCacheMetricsManageJob 
job(VisorCacheMetricsManageTaskArg arg) {
+        return new VisorCacheMetricsManageJob(arg, false);
+    }
+
+    /**
+     * Job result is a collection of processed cache names.
+     */
+    private static class VisorCacheMetricsManageJob extends 
VisorJob<VisorCacheMetricsManageTaskArg,
+        VisorCacheMetricsManageTaskResult> {
+        /** 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 VisorCacheMetricsManageJob(@Nullable 
VisorCacheMetricsManageTaskArg arg, boolean debug) {
+            super(arg, debug);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected VisorCacheMetricsManageTaskResult run(@Nullable 
VisorCacheMetricsManageTaskArg arg)
+            throws IgniteException {
+            if (arg != null) {
+                Collection<String> cacheNames = arg.applyToAllCaches() ? 
ignite.cacheNames() : arg.cacheNames();
+
+                try {
+                    switch (arg.subCommand()) {
+                        case ENABLE:
+                        case DISABLE:
+                            ignite.cluster().enableStatistics(cacheNames, 
ENABLE == arg.subCommand());

Review Comment:
   Good point, I'll prepare fix soon.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to