You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/10 11:23:34 UTC
[25/50] incubator-ignite git commit: # IGNITE-992 Review.
# IGNITE-992 Review.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/662f7337
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/662f7337
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/662f7337
Branch: refs/heads/ignite-929
Commit: 662f7337f7d03f94373f4ebd083d308823aff50c
Parents: a5b5ec7
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon Jun 8 16:44:25 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon Jun 8 16:44:25 2015 +0700
----------------------------------------------------------------------
.../internal/util/IgniteExceptionRegistry.java | 7 +-
.../visor/node/VisorNodeDataCollectorTask.java | 9 ++-
.../node/VisorNodeDataCollectorTaskResult.java | 17 +++--
.../internal/visor/query/VisorQueryJob.java | 11 +--
.../internal/visor/query/VisorQueryTask.java | 3 +-
.../visor/util/VisorExceptionWrapper.java | 78 ++++++++++++++++++++
.../internal/visor/util/VisorTaskUtils.java | 10 +++
7 files changed, 114 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
index ab113d7..a56570a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.util;
import org.apache.ignite.*;
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.internal.visor.util.*;
import java.io.*;
import java.util.*;
@@ -160,7 +161,7 @@ public class IgniteExceptionRegistry {
/** */
@GridToStringExclude
- private final Throwable error;
+ private final VisorExceptionWrapper error;
/** */
private final long threadId;
@@ -186,7 +187,7 @@ public class IgniteExceptionRegistry {
*/
public ExceptionInfo(long order, Throwable error, String msg, long threadId, String threadName, long time) {
this.order = order;
- this.error = error;
+ this.error = VisorTaskUtils.wrap(error);
this.threadId = threadId;
this.threadName = threadName;
this.time = time;
@@ -210,7 +211,7 @@ public class IgniteExceptionRegistry {
/**
* @return Suppressed error.
*/
- public Throwable error() {
+ public VisorExceptionWrapper error() {
return error;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
index fde871b..7dbfd39 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
@@ -23,6 +23,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.*;
@@ -87,7 +88,7 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
else {
// Ignore nodes that left topology.
if (!(unhandledEx instanceof ClusterGroupEmptyException))
- taskRes.unhandledEx().put(nid, unhandledEx);
+ taskRes.unhandledEx().put(nid, VisorTaskUtils.wrap(unhandledEx));
}
}
}
@@ -116,13 +117,13 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
taskRes.events().addAll(jobRes.events());
if (jobRes.eventsEx() != null)
- taskRes.eventsEx().put(nid, jobRes.eventsEx());
+ taskRes.eventsEx().put(nid, VisorTaskUtils.wrap(jobRes.eventsEx()));
if (!jobRes.caches().isEmpty())
taskRes.caches().put(nid, jobRes.caches());
if (jobRes.cachesEx() != null)
- taskRes.cachesEx().put(nid, jobRes.cachesEx());
+ taskRes.cachesEx().put(nid, VisorTaskUtils.wrap(jobRes.cachesEx()));
if (!jobRes.igfss().isEmpty())
taskRes.igfss().put(nid, jobRes.igfss());
@@ -131,6 +132,6 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
taskRes.igfsEndpoints().put(nid, jobRes.igfsEndpoints());
if (jobRes.igfssEx() != null)
- taskRes.igfssEx().put(nid, jobRes.igfssEx());
+ taskRes.igfssEx().put(nid, VisorTaskUtils.wrap(jobRes.igfssEx()));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
index 6485978..1a4eb02 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.visor.node;
import org.apache.ignite.internal.visor.cache.*;
import org.apache.ignite.internal.visor.event.*;
import org.apache.ignite.internal.visor.igfs.*;
+import org.apache.ignite.internal.visor.util.*;
import java.io.*;
import java.util.*;
@@ -32,7 +33,7 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
private static final long serialVersionUID = 0L;
/** Unhandled exceptions from nodes. */
- private final Map<UUID, Throwable> unhandledEx = new HashMap<>();
+ private final Map<UUID, VisorExceptionWrapper> unhandledEx = new HashMap<>();
/** Nodes grid names. */
private final Map<UUID, String> gridNames = new HashMap<>();
@@ -50,13 +51,13 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
private final List<VisorGridEvent> evts = new ArrayList<>();
/** Exceptions caught during collecting events from nodes. */
- private final Map<UUID, Throwable> evtsEx = new HashMap<>();
+ private final Map<UUID, VisorExceptionWrapper> evtsEx = new HashMap<>();
/** All caches collected from nodes. */
private final Map<UUID, Collection<VisorCache>> caches = new HashMap<>();
/** Exceptions caught during collecting caches from nodes. */
- private final Map<UUID, Throwable> cachesEx = new HashMap<>();
+ private final Map<UUID, VisorExceptionWrapper> cachesEx = new HashMap<>();
/** All IGFS collected from nodes. */
private final Map<UUID, Collection<VisorIgfs>> igfss = new HashMap<>();
@@ -65,7 +66,7 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
private final Map<UUID, Collection<VisorIgfsEndpoint>> igfsEndpoints = new HashMap<>();
/** Exceptions caught during collecting IGFS from nodes. */
- private final Map<UUID, Throwable> igfssEx = new HashMap<>();
+ private final Map<UUID, VisorExceptionWrapper> igfssEx = new HashMap<>();
/**
* @return {@code true} If no data was collected.
@@ -88,7 +89,7 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
/**
* @return Unhandled exceptions from nodes.
*/
- public Map<UUID, Throwable> unhandledEx() {
+ public Map<UUID, VisorExceptionWrapper> unhandledEx() {
return unhandledEx;
}
@@ -123,7 +124,7 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
/**
* @return Exceptions caught during collecting events from nodes.
*/
- public Map<UUID, Throwable> eventsEx() {
+ public Map<UUID, VisorExceptionWrapper> eventsEx() {
return evtsEx;
}
@@ -137,7 +138,7 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
/**
* @return Exceptions caught during collecting caches from nodes.
*/
- public Map<UUID, Throwable> cachesEx() {
+ public Map<UUID, VisorExceptionWrapper> cachesEx() {
return cachesEx;
}
@@ -158,7 +159,7 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
/**
* @return Exceptions caught during collecting IGFS from nodes.
*/
- public Map<UUID, Throwable> igfssEx() {
+ public Map<UUID, VisorExceptionWrapper> igfssEx() {
return igfssEx;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
index 8915240..82555cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.query.*;
import org.apache.ignite.internal.processors.timeout.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.internal.visor.*;
+import org.apache.ignite.internal.visor.util.*;
import org.apache.ignite.lang.*;
import javax.cache.*;
@@ -36,7 +37,7 @@ import static org.apache.ignite.internal.visor.query.VisorQueryUtils.*;
/**
* Job for execute SCAN or SQL query and get first page of results.
*/
-public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? extends Exception, VisorQueryResultEx>> {
+public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx>> {
/** */
private static final long serialVersionUID = 0L;
@@ -61,7 +62,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
}
/** {@inheritDoc} */
- @Override protected IgniteBiTuple<? extends Exception, VisorQueryResultEx> run(VisorQueryArg arg) {
+ @Override protected IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx> run(VisorQueryArg arg) {
try {
UUID nid = ignite.localNode().id();
@@ -110,8 +111,8 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
Collection<GridQueryFieldMetadata> meta = cur.fieldsMeta();
if (meta == null)
- return new IgniteBiTuple<Exception, VisorQueryResultEx>(
- new SQLException("Fail to execute query. No metadata available."), null);
+ return new IgniteBiTuple<>(
+ VisorTaskUtils.wrap(new SQLException("Fail to execute query. No metadata available.")), null);
else {
List<VisorQueryField> names = new ArrayList<>(meta.size());
@@ -138,7 +139,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
}
}
catch (Exception e) {
- return new IgniteBiTuple<>(e, null);
+ return new IgniteBiTuple<>(VisorTaskUtils.wrap(e), null);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
index 4f2fda5..98c876a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
@@ -19,13 +19,14 @@ package org.apache.ignite.internal.visor.query;
import org.apache.ignite.internal.processors.task.*;
import org.apache.ignite.internal.visor.*;
+import org.apache.ignite.internal.visor.util.*;
import org.apache.ignite.lang.*;
/**
* Task for execute SCAN or SQL query and get first page of results.
*/
@GridInternal
-public class VisorQueryTask extends VisorOneNodeTask<VisorQueryArg, IgniteBiTuple<? extends Exception, VisorQueryResultEx>> {
+public class VisorQueryTask extends VisorOneNodeTask<VisorQueryArg, IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx>> {
/** */
private static final long serialVersionUID = 0L;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
new file mode 100644
index 0000000..be6f63c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
@@ -0,0 +1,78 @@
+/*
+ * 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;
+
+/**
+ * Wrapper of exceptions for transferring to Visor with absent exception classes.
+ */
+public class VisorExceptionWrapper extends Throwable {
+ /** Detail message string of this throwable */
+ private String detailMsg;
+
+ /** Simple class name of original throwable */
+ private String originalName;
+
+ /** Full class name of original throwable */
+ private String fullName;
+
+ /**
+ * Wrap throwable by presented on Visor throwable object.
+ *
+ * @param cause Base throwable object.
+ */
+ public VisorExceptionWrapper(Throwable cause) {
+ assert cause != null;
+
+ originalName = cause.getClass().getSimpleName();
+ fullName = cause.getClass().getName();
+
+ detailMsg = cause.getMessage();
+
+ StackTraceElement[] stackTrace = cause.getStackTrace();
+
+ if (stackTrace != null)
+ setStackTrace(stackTrace);
+
+ if (cause.getCause() != null)
+ initCause(new VisorExceptionWrapper(cause.getCause()));
+ }
+
+ /**
+ * @return Simple name of base throwable object.
+ */
+ public String getOriginalName() {
+ return originalName;
+ }
+
+ /**
+ * @return Full name of base throwable object.
+ */
+ public String getFullName() {
+ return fullName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getMessage() {
+ return detailMsg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return (detailMsg != null) ? (fullName + ": " + detailMsg) : fullName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index e8ae76d..b0afbc9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -867,4 +867,14 @@ public class VisorTaskUtils {
return bos.toByteArray();
}
+
+ /**
+ * Wrap throwable object of any type to presented on Visor throwable object.
+ *
+ * @param e Base throwable object.
+ * @return Wrapped throwable object.
+ */
+ public static VisorExceptionWrapper wrap(Throwable e) {
+ return new VisorExceptionWrapper(e);
+ }
}