ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [01/45] incubator-ignite git commit: # GG-10404 Added check for empty topology for query cleanup task.
Date Tue, 30 Jun 2015 08:03:54 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-961 8379cd755 -> d5aa28c01


# GG-10404 Added check for empty topology for query cleanup task.


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

Branch: refs/heads/ignite-961
Commit: 32697ab08071c708c9f8b4c1b70b2ee4ab62d858
Parents: f0e74c0
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Fri Jun 12 11:19:37 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Fri Jun 12 11:19:37 2015 +0700

----------------------------------------------------------------------
 .../connection/GridClientNioTcpConnection.java  |  7 ++++-
 .../visor/query/VisorQueryCleanupTask.java      | 14 +++++++++
 .../visor/util/VisorEmptyTopologyException.java | 33 ++++++++++++++++++++
 3 files changed, 53 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/32697ab0/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
index d247e05..67709b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
@@ -750,7 +750,12 @@ public class GridClientNioTcpConnection extends GridClientConnection
{
             new GridClientFutureCallback<GridClientTaskResultBean, R>() {
                 @Override public R onComplete(GridClientFuture<GridClientTaskResultBean>
fut)
                     throws GridClientException {
-                    return fut.get().getResult();
+                    GridClientTaskResultBean resBean = fut.get();
+
+                    if (resBean != null)
+                        return resBean.getResult();
+                    else
+                        return null;
                 }
             });
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/32697ab0/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java
index 722ad91..b9a55e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java
@@ -22,6 +22,7 @@ import org.apache.ignite.compute.*;
 import org.apache.ignite.internal.processors.task.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.internal.visor.*;
+import org.apache.ignite.internal.visor.util.*;
 import org.jetbrains.annotations.*;
 
 import java.util.*;
@@ -47,6 +48,9 @@ public class VisorQueryCleanupTask extends VisorMultiNodeTask<Map<UUID,
Collecti
         @Nullable VisorTaskArgument<Map<UUID, Collection<String>>> arg)
{
         Set<UUID> nodeIds = taskArg.keySet();
 
+        if (nodeIds.isEmpty())
+            throw new VisorEmptyTopologyException("Nothing to clear. List with node IDs is
empty!");
+
         Map<ComputeJob, ClusterNode> map = U.newHashMap(nodeIds.size());
 
         try {
@@ -54,6 +58,16 @@ public class VisorQueryCleanupTask extends VisorMultiNodeTask<Map<UUID,
Collecti
                 if (nodeIds.contains(node.id()))
                     map.put(new VisorQueryCleanupJob(taskArg.get(node.id()), debug), node);
 
+            if (map.isEmpty()) {
+                String notFoundNodes = "";
+
+                for (UUID nid : nodeIds)
+                    notFoundNodes = notFoundNodes + (notFoundNodes.isEmpty() ? "" : ",")
 + U.id8(nid);
+
+                throw new VisorEmptyTopologyException("Failed to clear query results. Nodes
are not available: [" +
+                    notFoundNodes + "]");
+            }
+
             return map;
         }
         finally {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/32697ab0/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorEmptyTopologyException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorEmptyTopologyException.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorEmptyTopologyException.java
new file mode 100644
index 0000000..fda1bd7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorEmptyTopologyException.java
@@ -0,0 +1,33 @@
+/*
+ * 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.util;
+
+import org.apache.ignite.*;
+
+/**
+ * Marker exception for indication of empty topology in Visor tasks.
+ */
+public class VisorEmptyTopologyException extends IgniteException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** @inheritDoc */
+    public VisorEmptyTopologyException(String msg) {
+        super(msg);
+    }
+}


Mime
View raw message