# GG-10404 Suppress Visor exceptions.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c62c410b Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c62c410b Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c62c410b Branch: refs/heads/ignite-gg-10239 Commit: c62c410bcf1a1f353fa586e515f846746cb4a482 Parents: 6779071 Author: AKuznetsov <akuznet...@gridgain.com> Authored: Fri Jun 12 17:39:09 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Fri Jun 12 17:39:09 2015 +0700 ---------------------------------------------------------------------- .../connection/GridClientNioTcpConnection.java | 7 +---- .../processors/rest/GridRestProcessor.java | 4 ++- .../handlers/task/GridTaskCommandHandler.java | 12 ++++--- .../processors/task/GridTaskWorker.java | 4 ++- .../visor/query/VisorQueryCleanupTask.java | 4 +-- .../util/VisorClusterGroupEmptyException.java | 33 ++++++++++++++++++++ .../visor/util/VisorEmptyTopologyException.java | 33 -------------------- 7 files changed, 50 insertions(+), 47 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c62c410b/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 67709b8..d247e05 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,12 +750,7 @@ public class GridClientNioTcpConnection extends GridClientConnection { new GridClientFutureCallback<GridClientTaskResultBean, R>() { @Override public R onComplete(GridClientFuture<GridClientTaskResultBean> fut) throws GridClientException { - GridClientTaskResultBean resBean = fut.get(); - - if (resBean != null) - return resBean.getResult(); - else - return null; + return fut.get().getResult(); } }); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c62c410b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index 52ca610..2d1d802 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -36,6 +36,7 @@ import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.worker.*; +import org.apache.ignite.internal.visor.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.security.*; import org.apache.ignite.plugin.security.SecurityException; @@ -214,7 +215,8 @@ public class GridRestProcessor extends GridProcessorAdapter { res = f.get(); } catch (Exception e) { - LT.error(log, e, "Failed to handle request: " + req.command()); + if (!X.hasCause(e, VisorClusterGroupEmptyException.class)) + LT.error(log, e, "Failed to handle request: " + req.command()); if (log.isDebugEnabled()) log.debug("Failed to handle request [req=" + req + ", e=" + e + "]"); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c62c410b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskCommandHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskCommandHandler.java index a647cd1..d832b21 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskCommandHandler.java @@ -33,6 +33,7 @@ import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.internal.visor.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.resources.*; import org.jetbrains.annotations.*; @@ -134,7 +135,8 @@ public class GridTaskCommandHandler extends GridRestCommandHandlerAdapter { return handleAsyncUnsafe(req); } catch (IgniteCheckedException e) { - U.error(log, "Failed to execute task command: " + req, e); + if (!X.hasCause(e, VisorClusterGroupEmptyException.class)) + U.error(log, "Failed to execute task command: " + req, e); return new GridFinishedFuture<>(e); } @@ -237,9 +239,11 @@ public class GridTaskCommandHandler extends GridRestCommandHandlerAdapter { U.warn(log, "Failed to execute task due to topology issues (are all mapped " + "nodes alive?) [name=" + name + ", clientId=" + req.clientId() + ", err=" + e + ']'); - else - U.error(log, "Failed to execute task [name=" + name + ", clientId=" + - req.clientId() + ']', e); + else { + if (!X.hasCause(e, VisorClusterGroupEmptyException.class)) + U.error(log, "Failed to execute task [name=" + name + ", clientId=" + + req.clientId() + ']', e); + } desc = new TaskDescriptor(true, null, e); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c62c410b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java index f6d686c..eb5fa77 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java @@ -30,6 +30,7 @@ import org.apache.ignite.internal.processors.timeout.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.worker.*; +import org.apache.ignite.internal.visor.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; import org.apache.ignite.resources.*; @@ -443,7 +444,8 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject { } catch (IgniteException | IgniteCheckedException e) { if (!fut.isCancelled()) { - U.error(log, "Failed to map task jobs to nodes: " + ses, e); + if (!(e instanceof VisorClusterGroupEmptyException)) + U.error(log, "Failed to map task jobs to nodes: " + ses, e); finishTask(null, e); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c62c410b/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 b9a55e1..5ceb300 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 @@ -49,7 +49,7 @@ public class VisorQueryCleanupTask extends VisorMultiNodeTask<Map<UUID, Collecti Set<UUID> nodeIds = taskArg.keySet(); if (nodeIds.isEmpty()) - throw new VisorEmptyTopologyException("Nothing to clear. List with node IDs is empty!"); + throw new VisorClusterGroupEmptyException("Nothing to clear. List with node IDs is empty!"); Map<ComputeJob, ClusterNode> map = U.newHashMap(nodeIds.size()); @@ -64,7 +64,7 @@ public class VisorQueryCleanupTask extends VisorMultiNodeTask<Map<UUID, Collecti for (UUID nid : nodeIds) notFoundNodes = notFoundNodes + (notFoundNodes.isEmpty() ? "" : ",") + U.id8(nid); - throw new VisorEmptyTopologyException("Failed to clear query results. Nodes are not available: [" + + throw new VisorClusterGroupEmptyException("Failed to clear query results. Nodes are not available: [" + notFoundNodes + "]"); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c62c410b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorClusterGroupEmptyException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorClusterGroupEmptyException.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorClusterGroupEmptyException.java new file mode 100644 index 0000000..b969178 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorClusterGroupEmptyException.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.cluster.*; + +/** + * Exception to throw from Visor tasks in case of empty topology. + */ +public class VisorClusterGroupEmptyException extends ClusterGroupEmptyException { + /** */ + private static final long serialVersionUID = 0L; + + /** @inheritDoc */ + public VisorClusterGroupEmptyException(String msg) { + super(msg); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c62c410b/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 deleted file mode 100644 index fda1bd7..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorEmptyTopologyException.java +++ /dev/null @@ -1,33 +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.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); - } -}