ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [17/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0
Date Mon, 17 Apr 2017 08:21:39 GMT
IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9b61a76b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9b61a76b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9b61a76b

Branch: refs/heads/ignite-1561-1
Commit: 9b61a76bd2f5f18e50081b2553e58bf36375b8ab
Parents: 12dfe9e
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Fri Apr 14 20:59:26 2017 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Fri Apr 14 20:59:26 2017 +0700

----------------------------------------------------------------------
 .../visor/query/VisorCancelQueriesTask.java     | 72 ---------------
 .../query/VisorCollectRunningQueriesTask.java   | 96 --------------------
 .../query/VisorQueryScanSubstringFilter.java    | 64 -------------
 3 files changed, 232 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9b61a76b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java
deleted file mode 100644
index a6f2d82..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.query;
-
-import java.util.Collection;
-import java.util.List;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.visor.VisorJob;
-import org.apache.ignite.internal.visor.VisorOneNodeTask;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Task to cancel queries.
- */
-@GridInternal
-public class VisorCancelQueriesTask extends VisorOneNodeTask<Collection<Long>, Void>
{
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** {@inheritDoc} */
-    @Override protected VisorCancelQueriesJob job(Collection<Long> arg) {
-        return new VisorCancelQueriesJob(arg, debug);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected Void reduce0(List<ComputeJobResult> results) throws
IgniteException {
-        return null;
-    }
-
-    /**
-     * Job to cancel queries on node.
-     */
-    private static class VisorCancelQueriesJob extends VisorJob<Collection<Long>,
Void> {
-        /** */
-        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 VisorCancelQueriesJob(@Nullable Collection<Long> arg, boolean debug)
{
-            super(arg, debug);
-        }
-
-        /** {@inheritDoc} */
-        @Override protected Void run(@Nullable Collection<Long> queries) throws IgniteException
{
-            ignite.context().query().cancelQueries(queries);
-
-            return null;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9b61a76b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java
deleted file mode 100644
index 2b40e61..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.query;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
-import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.internal.visor.VisorJob;
-import org.apache.ignite.internal.visor.VisorMultiNodeTask;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Task to collect currently running queries.
- */
-@GridInternal
-public class VisorCollectRunningQueriesTask extends VisorMultiNodeTask<Long, Map<UUID,
Collection<VisorRunningQuery>>, Collection<VisorRunningQuery>> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** {@inheritDoc} */
-    @Override protected VisorCollectRunningQueriesJob job(Long arg) {
-        return new VisorCollectRunningQueriesJob(arg, debug);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected Map<UUID, Collection<VisorRunningQuery>> reduce0(List<ComputeJobResult>
results) throws IgniteException {
-        Map<UUID, Collection<VisorRunningQuery>> map = new HashMap<>();
-
-        for (ComputeJobResult res : results)
-            if (res.getException() == null) {
-                Collection<VisorRunningQuery> queries = res.getData();
-
-                map.put(res.getNode().id(), queries);
-            }
-
-        return map;
-    }
-
-    /**
-     * Job to collect currently running queries from node.
-     */
-    private static class VisorCollectRunningQueriesJob extends VisorJob<Long, Collection<VisorRunningQuery>>
{
-        /** */
-        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 VisorCollectRunningQueriesJob(@Nullable Long arg, boolean debug) {
-            super(arg, debug);
-        }
-
-        /** {@inheritDoc} */
-        @Override protected Collection<VisorRunningQuery> run(@Nullable Long duration)
throws IgniteException {
-            Collection<GridRunningQueryInfo> queries = ignite.context().query()
-                .runningQueries(duration != null ? duration : 0);
-
-            Collection<VisorRunningQuery> res = new ArrayList<>(queries.size());
-
-            long curTime = U.currentTimeMillis();
-
-            for (GridRunningQueryInfo qry : queries)
-                res.add(new VisorRunningQuery(qry.id(), qry.query(), qry.queryType(), qry.cache(),
-                    qry.startTime(), curTime - qry.startTime(),
-                    qry.cancelable(), qry.local()));
-
-            return res;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9b61a76b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
deleted file mode 100644
index 171698b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.query;
-
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.lang.IgniteBiPredicate;
-
-/**
- * Filter scan results by specified substring in string presentation of key or value.
- */
-public class VisorQueryScanSubstringFilter implements IgniteBiPredicate<Object, Object>
{
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Case sensitive flag. */
-    private final boolean caseSensitive;
-
-    /** String to search in string presentation of key or value. */
-    private final String ptrn;
-
-    /**
-     * Create filter instance.
-     *
-     * @param caseSensitive Case sensitive flag.
-     * @param ptrn String to search in string presentation of key or value.
-     */
-    public VisorQueryScanSubstringFilter(boolean caseSensitive, String ptrn) {
-        this.caseSensitive = caseSensitive;
-
-        this.ptrn = caseSensitive ? ptrn : ptrn.toUpperCase();
-    }
-
-    /**
-     * Check that key or value contains specified string.
-     *
-     * @param key Key object.
-     * @param val Value object.
-     * @return {@code true} when string presentation of key or value contain specified string.
-     */
-    @Override public boolean apply(Object key, Object val) {
-        String k = key instanceof BinaryObject ? VisorQueryUtils.binaryToString((BinaryObject)key)
: key.toString();
-        String v = val instanceof BinaryObject ? VisorQueryUtils.binaryToString((BinaryObject)val)
: val.toString();
-
-        if (caseSensitive)
-            return k.contains(ptrn) || v.contains(ptrn);
-
-        return k.toUpperCase().contains(ptrn) || v.toUpperCase().contains(ptrn);
-    }
-}


Mime
View raw message