ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [35/50] ignite git commit: Removed unused classes.
Date Mon, 14 Aug 2017 10:30:45 GMT
Removed unused classes.


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

Branch: refs/heads/ignite-5991-6019
Commit: 8c731b3f363d4a60f356bda136eea8531c490166
Parents: 6984d0d
Author: devozerov <vozerov@gridgain.com>
Authored: Mon Aug 14 11:32:07 2017 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Mon Aug 14 11:32:07 2017 +0300

----------------------------------------------------------------------
 .../processors/query/h2/IgniteH2Indexing.java   |   2 +-
 .../query/h2/twostep/GridMapQueryExecutor.java  |   2 -
 .../query/h2/twostep/MapQueryLazyWorker.java    | 138 ++++++++++++++++++
 .../query/h2/twostep/MapQueryLazyWorkerKey.java |  97 +++++++++++++
 .../query/h2/twostep/MapQueryResult.java        |   1 -
 .../query/h2/twostep/MapQueryResults.java       |   1 -
 .../h2/twostep/lazy/MapQueryLazyExecutor.java   | 106 --------------
 .../twostep/lazy/MapQueryLazyIgniteThread.java  |  65 ---------
 .../h2/twostep/lazy/MapQueryLazyWorker.java     | 139 -------------------
 .../twostep/lazy/MapQueryLazyWorkerFactory.java |  47 -------
 .../h2/twostep/lazy/MapQueryLazyWorkerKey.java  |  97 -------------
 11 files changed, 236 insertions(+), 459 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8c731b3f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index f79d3cf..d6cc7e7 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -112,7 +112,7 @@ import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter;
 import org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor;
 import org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor;
 import org.apache.ignite.internal.processors.query.h2.twostep.MapQueryStreamingResultTarget;
-import org.apache.ignite.internal.processors.query.h2.twostep.lazy.MapQueryLazyWorker;
+import org.apache.ignite.internal.processors.query.h2.twostep.MapQueryLazyWorker;
 import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
 import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8c731b3f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index 8c418ab..488e408 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -58,8 +58,6 @@ import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
 import org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryContext;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2RetryException;
-import org.apache.ignite.internal.processors.query.h2.twostep.lazy.MapQueryLazyWorker;
-import org.apache.ignite.internal.processors.query.h2.twostep.lazy.MapQueryLazyWorkerKey;
 import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest;
 import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse;
 import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8c731b3f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryLazyWorker.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryLazyWorker.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryLazyWorker.java
new file mode 100644
index 0000000..8cc68e0
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryLazyWorker.java
@@ -0,0 +1,138 @@
+/*
+ * 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.processors.query.h2.twostep;
+
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.util.worker.GridWorker;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingDeque;
+
+/**
+ * Worker for lazy query execution.
+ */
+public class MapQueryLazyWorker extends GridWorker {
+    /** Lazy thread flag. */
+    private static final ThreadLocal<MapQueryLazyWorker> LAZY_WORKER = new ThreadLocal<>();
+
+    /** Task to be executed. */
+    private final BlockingQueue<Runnable> tasks = new LinkedBlockingDeque<>();
+
+    /** Key. */
+    private final MapQueryLazyWorkerKey key;
+
+    /** Map query executor. */
+    private final GridMapQueryExecutor exec;
+
+    /**
+     * Constructor.
+     *
+     * @param instanceName Instance name.
+     * @param key Lazy worker key.
+     * @param log Logger.
+     * @param exec Map query executor.
+     */
+    public MapQueryLazyWorker(@Nullable String instanceName, MapQueryLazyWorkerKey key, IgniteLogger
log,
+        GridMapQueryExecutor exec) {
+        super(instanceName, workerName(key), log);
+
+        this.key = key;
+        this.exec = exec;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException
{
+        LAZY_WORKER.set(this);
+
+        try {
+            while (!isCancelled()) {
+                Runnable task = tasks.poll();
+
+                if (task != null)
+                    task.run();
+            }
+        }
+        finally {
+            LAZY_WORKER.set(null);
+
+            exec.unregisterLazyWorkerIfNeeded();
+        }
+    }
+
+    /**
+     * Submit task to worker.
+     *
+     * @param task Task to be executed.
+     */
+    public void submit(Runnable task) {
+        tasks.add(task);
+    }
+
+    /**
+     * @return Worker key.
+     */
+    public MapQueryLazyWorkerKey key() {
+        return key;
+    }
+
+    /**
+     * Stop the worker.
+     */
+    public void stop() {
+        submit(new StopTask());
+    }
+
+    /**
+     * Internal worker stop routine.
+     */
+    private void stop0() {
+        isCancelled = true;
+    }
+
+    /**
+     * @return Current worker or {@code null} if call is performed not from lazy worker thread.
+     */
+    @Nullable public static MapQueryLazyWorker currentWorker() {
+        return LAZY_WORKER.get();
+    }
+
+    /**
+     * Construct worker name.
+     *
+     * @param key Key.
+     * @return Name.
+     */
+    private static String workerName(MapQueryLazyWorkerKey key) {
+        return "query-lazy-worker_" + key.nodeId() + "_" + key.queryRequestId() + "_" + key.segment();
+    }
+
+    /**
+     * Internal stop task.
+     */
+    private static class StopTask implements Runnable {
+        @Override public void run() {
+            MapQueryLazyWorker worker = LAZY_WORKER.get();
+
+            assert worker != null;
+
+            worker.stop0();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8c731b3f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryLazyWorkerKey.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryLazyWorkerKey.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryLazyWorkerKey.java
new file mode 100644
index 0000000..a0f5ebb
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryLazyWorkerKey.java
@@ -0,0 +1,97 @@
+/*
+ * 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.processors.query.h2.twostep;
+
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+import java.util.UUID;
+
+/**
+ * Key to identify lazy worker.
+ */
+public class MapQueryLazyWorkerKey {
+    /** Client node ID. */
+    private final UUID nodeId;
+
+    /** Query request ID. */
+    private final long qryReqId;
+
+    /** Segment. */
+    private final int segment;
+
+    /**
+     * Constructor.
+     *
+     * @param nodeId Node ID.
+     * @param qryReqId Query request ID.
+     * @param segment Segment.
+     */
+    public MapQueryLazyWorkerKey(UUID nodeId, long qryReqId, int segment) {
+        this.nodeId = nodeId;
+        this.qryReqId = qryReqId;
+        this.segment = segment;
+    }
+
+    /**
+     * @return Node id.
+     */
+    public UUID nodeId() {
+        return nodeId;
+    }
+
+    /**
+     * @return Query request ID.
+     */
+    public long queryRequestId() {
+        return qryReqId;
+    }
+
+    /**
+     * @return Segment.
+     */
+    public int segment() {
+        return segment;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = nodeId.hashCode();
+
+        res = 31 * res + (int)(qryReqId ^ (qryReqId >>> 32));
+        res = 31 * res + segment;
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        if (obj != null && obj instanceof MapQueryLazyWorkerKey) {
+            MapQueryLazyWorkerKey other = (MapQueryLazyWorkerKey)obj;
+
+            return F.eq(qryReqId, other.qryReqId) && F.eq(nodeId, other.nodeId) &&
F.eq(segment, other.segment);
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(MapQueryLazyWorkerKey.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8c731b3f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResult.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResult.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResult.java
index 8c22259..a1f8a64 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResult.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResult.java
@@ -23,7 +23,6 @@ import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
 import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
 import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2ValueCacheObject;
-import org.apache.ignite.internal.processors.query.h2.twostep.lazy.MapQueryLazyWorker;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8c731b3f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResults.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResults.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResults.java
index ed79c14..fb1d6c7 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResults.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/MapQueryResults.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.query.h2.twostep;
 import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
 import org.apache.ignite.internal.processors.query.GridQueryCancel;
 import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
-import org.apache.ignite.internal.processors.query.h2.twostep.lazy.MapQueryLazyWorker;
 import org.jetbrains.annotations.Nullable;
 
 import java.sql.ResultSet;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8c731b3f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyExecutor.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyExecutor.java
deleted file mode 100644
index d85e455..0000000
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyExecutor.java
+++ /dev/null
@@ -1,106 +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.processors.query.h2.twostep.lazy;
-
-import org.apache.ignite.internal.managers.communication.GridIoPolicy;
-import org.apache.ignite.thread.IgniteThreadPoolExecutor;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import static org.apache.ignite.configuration.IgniteConfiguration.DFLT_THREAD_KEEP_ALIVE_TIME;
-
-/**
- * Pool of workers for lazy query execution.
- */
-public class MapQueryLazyExecutor {
-    /** Executor responsible for shared task dispatch. */
-    private final IgniteThreadPoolExecutor exec;
-
-    /** Threads. */
-    private final ConcurrentHashMap<Long, MapQueryLazyIgniteThread> threads = new ConcurrentHashMap<>();
-
-    /**
-     * Constructor.
-     *
-     * @param igniteInstanceName Ignite instance name.
-     * @param poolSize Thread pool size.
-     */
-    public MapQueryLazyExecutor(String igniteInstanceName, int poolSize) {
-        assert poolSize > 0;
-
-        exec = new IgniteThreadPoolExecutor(
-            "query-lazy",
-            igniteInstanceName,
-            poolSize,
-            poolSize,
-            DFLT_THREAD_KEEP_ALIVE_TIME,
-            new LinkedBlockingQueue<Runnable>(),
-            GridIoPolicy.SYSTEM_POOL);
-    }
-
-    /**
-     * Submit a command to a dedicated worker, or enqueue in case no workers are available.
-     *
-     * @param cmd Shared command to be executed.
-     */
-    public void submitShared(final Runnable cmd) {
-        Runnable r = new Runnable() {
-            @Override public void run() {
-                // Register thread in a shared map.
-                MapQueryLazyIgniteThread thread = (MapQueryLazyIgniteThread)Thread.currentThread();
-
-                long threadKey = thread.index();
-
-                threads.put(threadKey, thread);
-
-                try {
-                    cmd.run();
-                }
-                finally {
-                    threads.remove(threadKey);
-                }
-            }
-        };
-
-        exec.submit(r);
-    }
-
-    /**
-     * Submit a task for specific thread.
-     *
-     * @param idx Index.
-     * @param cmd Command to be executed.
-     */
-    public void submit(long idx, Runnable cmd) {
-        MapQueryLazyIgniteThread thread = threads.get(idx);
-
-        if (thread != null)
-            thread.submit(cmd);
-    }
-
-    /**
-     * Shutdown the cluster.
-     */
-    public void shutdown() {
-        exec.shutdown();
-
-        for (MapQueryLazyIgniteThread thread : threads.values())
-            thread.shutdown();
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8c731b3f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyIgniteThread.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyIgniteThread.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyIgniteThread.java
deleted file mode 100644
index a207ef0..0000000
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyIgniteThread.java
+++ /dev/null
@@ -1,65 +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.processors.query.h2.twostep.lazy;
-
-import org.apache.ignite.thread.IgniteThread;
-
-/**
- * Ignite thread for lazy map query execution.
- */
-public class MapQueryLazyIgniteThread extends IgniteThread {
-    /** Thread index. */
-    private final long idx;
-
-    /**
-     * Constructor.
-     *
-     * @param igniteInstanceName Ignite instance name.
-     * @param threadName Thread name.
-     * @param r Runnable.
-     * @param idx Index.
-     */
-    public MapQueryLazyIgniteThread(String igniteInstanceName, String threadName, Runnable
r, long idx) {
-        super(igniteInstanceName, threadName, r);
-
-        this.idx = idx;
-    }
-
-    /**
-     * @return Thread index.
-     */
-    public long index() {
-        return idx;
-    }
-
-    /**
-     * Submit new runnable.
-     *
-     * @param r Runnable to be executed.
-     */
-    public void submit(Runnable r) {
-        // TODO
-    }
-
-    /**
-     * Shutdown the thread.
-     */
-    public void shutdown() {
-        // TODO
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8c731b3f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyWorker.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyWorker.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyWorker.java
deleted file mode 100644
index 0b9297f..0000000
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyWorker.java
+++ /dev/null
@@ -1,139 +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.processors.query.h2.twostep.lazy;
-
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.IgniteInterruptedCheckedException;
-import org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor;
-import org.apache.ignite.internal.util.worker.GridWorker;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingDeque;
-
-/**
- * Worker for lazy query execution.
- */
-public class MapQueryLazyWorker extends GridWorker {
-    /** Lazy thread flag. */
-    private static final ThreadLocal<MapQueryLazyWorker> LAZY_WORKER = new ThreadLocal<>();
-
-    /** Task to be executed. */
-    private final BlockingQueue<Runnable> tasks = new LinkedBlockingDeque<>();
-
-    /** Key. */
-    private final MapQueryLazyWorkerKey key;
-
-    /** Map query executor. */
-    private final GridMapQueryExecutor exec;
-
-    /**
-     * Constructor.
-     *
-     * @param instanceName Instance name.
-     * @param key Lazy worker key.
-     * @param log Logger.
-     * @param exec Map query executor.
-     */
-    public MapQueryLazyWorker(@Nullable String instanceName, MapQueryLazyWorkerKey key, IgniteLogger
log,
-        GridMapQueryExecutor exec) {
-        super(instanceName, workerName(key), log);
-
-        this.key = key;
-        this.exec = exec;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException
{
-        LAZY_WORKER.set(this);
-
-        try {
-            while (!isCancelled()) {
-                Runnable task = tasks.poll();
-
-                if (task != null)
-                    task.run();
-            }
-        }
-        finally {
-            LAZY_WORKER.set(null);
-
-            exec.unregisterLazyWorkerIfNeeded();
-        }
-    }
-
-    /**
-     * Submit task to worker.
-     *
-     * @param task Task to be executed.
-     */
-    public void submit(Runnable task) {
-        tasks.add(task);
-    }
-
-    /**
-     * @return Worker key.
-     */
-    public MapQueryLazyWorkerKey key() {
-        return key;
-    }
-
-    /**
-     * Stop the worker.
-     */
-    public void stop() {
-        submit(new StopTask());
-    }
-
-    /**
-     * Internal worker stop routine.
-     */
-    private void stop0() {
-        isCancelled = true;
-    }
-
-    /**
-     * @return Current worker or {@code null} if call is performed not from lazy worker thread.
-     */
-    @Nullable public static MapQueryLazyWorker currentWorker() {
-        return LAZY_WORKER.get();
-    }
-
-    /**
-     * Construct worker name.
-     *
-     * @param key Key.
-     * @return Name.
-     */
-    private static String workerName(MapQueryLazyWorkerKey key) {
-        return "query-lazy-worker_" + key.nodeId() + "_" + key.queryRequestId() + "_" + key.segment();
-    }
-
-    /**
-     * Internal stop task.
-     */
-    private static class StopTask implements Runnable {
-        @Override public void run() {
-            MapQueryLazyWorker worker = LAZY_WORKER.get();
-
-            assert worker != null;
-
-            worker.stop0();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8c731b3f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyWorkerFactory.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyWorkerFactory.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyWorkerFactory.java
deleted file mode 100644
index 693853b..0000000
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyWorkerFactory.java
+++ /dev/null
@@ -1,47 +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.processors.query.h2.twostep.lazy;
-
-import org.apache.ignite.internal.managers.communication.GridIoPolicy;
-import org.apache.ignite.thread.IgniteThreadFactory;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * Factory for lazy mapper workers.
- */
-public class MapQueryLazyWorkerFactory extends IgniteThreadFactory {
-    /** Thread ID generator. */
-    private static final AtomicLong THREAD_ID_GEN = new AtomicLong();
-
-    /**
-     * Constructor.
-     *
-     * @param igniteInstanceName Ignite instance name.
-     * @param threadName Thread name.
-     */
-    public MapQueryLazyWorkerFactory(String igniteInstanceName, String threadName) {
-        super(igniteInstanceName, threadName, GridIoPolicy.QUERY_POOL);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Thread newThread(@NotNull Runnable r) {
-        return new MapQueryLazyIgniteThread(igniteInstanceName, threadName, r, THREAD_ID_GEN.incrementAndGet());
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8c731b3f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyWorkerKey.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyWorkerKey.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyWorkerKey.java
deleted file mode 100644
index 95af38f..0000000
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/lazy/MapQueryLazyWorkerKey.java
+++ /dev/null
@@ -1,97 +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.processors.query.h2.twostep.lazy;
-
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-import java.util.UUID;
-
-/**
- * Key to identify lazy worker.
- */
-public class MapQueryLazyWorkerKey {
-    /** Client node ID. */
-    private final UUID nodeId;
-
-    /** Query request ID. */
-    private final long qryReqId;
-
-    /** Segment. */
-    private final int segment;
-
-    /**
-     * Constructor.
-     *
-     * @param nodeId Node ID.
-     * @param qryReqId Query request ID.
-     * @param segment Segment.
-     */
-    public MapQueryLazyWorkerKey(UUID nodeId, long qryReqId, int segment) {
-        this.nodeId = nodeId;
-        this.qryReqId = qryReqId;
-        this.segment = segment;
-    }
-
-    /**
-     * @return Node id.
-     */
-    public UUID nodeId() {
-        return nodeId;
-    }
-
-    /**
-     * @return Query request ID.
-     */
-    public long queryRequestId() {
-        return qryReqId;
-    }
-
-    /**
-     * @return Segment.
-     */
-    public int segment() {
-        return segment;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = nodeId.hashCode();
-
-        res = 31 * res + (int)(qryReqId ^ (qryReqId >>> 32));
-        res = 31 * res + segment;
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object obj) {
-        if (obj != null && obj instanceof MapQueryLazyWorkerKey) {
-            MapQueryLazyWorkerKey other = (MapQueryLazyWorkerKey)obj;
-
-            return F.eq(qryReqId, other.qryReqId) && F.eq(nodeId, other.nodeId) &&
F.eq(segment, other.segment);
-        }
-
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(MapQueryLazyWorkerKey.class, this);
-    }
-}


Mime
View raw message