ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [14/19] ignite git commit: ignite-5155
Date Sat, 10 Jun 2017 06:20:45 GMT
ignite-5155


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

Branch: refs/heads/ignite-5155
Commit: acf211cf1fa24565a0675d8fcb79936eb08250b2
Parents: e480d4e
Author: sboikov <sboikov@gridgain.com>
Authored: Fri Jun 9 15:33:05 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri Jun 9 15:37:18 2017 +0300

----------------------------------------------------------------------
 .../ignite/internal/IgniteDiagnosticAware.java  |   5 +-
 .../ignite/internal/IgniteDiagnosticInfo.java   |  45 ++
 .../internal/IgniteDiagnosticMessage.java       | 459 +++----------------
 .../IgniteDiagnosticPrepareContext.java         | 272 +++++++++++
 .../apache/ignite/internal/IgniteKernal.java    |   2 +-
 .../processors/cache/GridCacheIoManager.java    |  13 +-
 .../GridCachePartitionExchangeManager.java      |  90 ++--
 .../distributed/dht/GridDhtTxPrepareFuture.java |   4 +-
 .../dht/GridPartitionedSingleGetFuture.java     |   5 +-
 .../colocated/GridDhtColocatedLockFuture.java   |   6 +-
 .../GridDhtPartitionsExchangeFuture.java        |  13 +-
 .../processors/cluster/ClusterProcessor.java    | 133 +++---
 .../managers/IgniteDiagnosticMessagesTest.java  |  33 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |   8 +-
 14 files changed, 538 insertions(+), 550 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticAware.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticAware.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticAware.java
index c5e3ab8..45a5f3a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticAware.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticAware.java
@@ -21,5 +21,8 @@ package org.apache.ignite.internal;
  *
  */
 public interface IgniteDiagnosticAware {
-    public void prepareRequest(IgniteDiagnosticMessage.PreparedRequest req);
+    /**
+     * @param ctx Context.
+     */
+    public void addDiagnosticRequest(IgniteDiagnosticPrepareContext ctx);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticInfo.java
new file mode 100644
index 0000000..f82f600
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticInfo.java
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+import java.io.Serializable;
+
+/**
+ *
+ */
+public class IgniteDiagnosticInfo implements Serializable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private String msg;
+
+    /**
+     * @param msg Message.
+     */
+    public IgniteDiagnosticInfo(String msg) {
+        this.msg = msg;
+    }
+
+    /**
+     * @return Message.
+     */
+    public String message() {
+        return msg;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
index 06572a3..4f37f53 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
@@ -20,18 +20,11 @@ package org.apache.ignite.internal;
 import java.nio.ByteBuffer;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
-import java.util.Objects;
 import java.util.Set;
-import java.util.TreeMap;
 import java.util.UUID;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
@@ -44,13 +37,14 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopolo
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.internal.util.typedef.T3;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiInClosure;
 import org.apache.ignite.lang.IgniteClosure;
-import org.apache.ignite.lang.IgniteReducer;
+import org.apache.ignite.marshaller.Marshaller;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -65,6 +59,9 @@ public class IgniteDiagnosticMessage implements Message {
     private static final long serialVersionUID = 0L;
 
     /** */
+    private static final int REQUEST_FLAG_MASK = 0x01;
+
+    /** */
     private static final ThreadLocal<DateFormat> dateFormat = new ThreadLocal<DateFormat>() {
         @Override protected DateFormat initialValue() {
             return new SimpleDateFormat("HH:mm:ss.SSS");
@@ -72,68 +69,69 @@ public class IgniteDiagnosticMessage implements Message {
     };
 
     /** */
-    private long futId;
+    private byte flags;
 
     /** */
-    private String msg;
+    private long futId;
 
     /** */
-    private byte[] cBytes;
+    private byte[] bytes;
 
     /**
      * Required by {@link GridIoMessageFactory}.
      */
-    @SuppressWarnings("WeakerAccess")
     public IgniteDiagnosticMessage() {
         // No-op.
     }
 
     /**
-     * @param ctx Context.
+     * @param marsh Marshaller.
      * @param c Closure to run.
      * @param futId Future ID.
      * @return Request message.
      * @throws IgniteCheckedException If failed.
      */
-    public static IgniteDiagnosticMessage createRequest(GridKernalContext ctx,
-        IgniteClosure<GridKernalContext, String> c,
+    public static IgniteDiagnosticMessage createRequest(Marshaller marsh,
+        IgniteClosure<GridKernalContext, IgniteDiagnosticInfo> c,
         long futId)
         throws IgniteCheckedException
     {
-        byte[] cBytes = U.marshal(ctx.config().getMarshaller(), c);
+        byte[] cBytes = U.marshal(marsh, c);
 
         IgniteDiagnosticMessage msg = new IgniteDiagnosticMessage();
 
         msg.futId = futId;
-        msg.cBytes = cBytes;
+        msg.bytes = cBytes;
+        msg.flags |= REQUEST_FLAG_MASK;
 
         return msg;
     }
 
     /**
-     * @param msg0 Message.
+     * @param resBytes Marshalled result.
      * @param futId Future ID.
      * @return Response message.
      */
-    public static IgniteDiagnosticMessage createResponse(String msg0, long futId) {
+    public static IgniteDiagnosticMessage createResponse(byte[] resBytes, long futId) {
         IgniteDiagnosticMessage msg = new IgniteDiagnosticMessage();
 
         msg.futId = futId;
-        msg.msg = msg0;
+        msg.bytes = resBytes;
 
         return msg;
     }
 
     /**
-     * @param ctx Context.
-     * @return Unmarshalled closure.
+     * @param marsh Marshaller.
+     * @return Unmarshalled payload.
      * @throws IgniteCheckedException If failed.
      */
-    public IgniteClosure<GridKernalContext, String> unmarshalClosure(GridKernalContext ctx)
+    @Nullable public <T> T unmarshal(Marshaller marsh)
         throws IgniteCheckedException {
-        assert cBytes != null;
+        if (bytes == null)
+            return null;
 
-        return U.unmarshal(ctx, cBytes, null);
+        return U.unmarshal(marsh, bytes, null);
     }
 
     /**
@@ -147,14 +145,7 @@ public class IgniteDiagnosticMessage implements Message {
      * @return {@code True} if this is request message.
      */
     public boolean request() {
-        return cBytes != null;
-    }
-
-    /**
-     * @return Message string.
-     */
-    public String message() {
-        return msg;
+        return (flags & REQUEST_FLAG_MASK) != 0;
     }
 
     /** {@inheritDoc} */
@@ -170,19 +161,19 @@ public class IgniteDiagnosticMessage implements Message {
 
         switch (writer.state()) {
             case 0:
-                if (!writer.writeByteArray("cBytes", cBytes))
+                if (!writer.writeByteArray("bytes", bytes))
                     return false;
 
                 writer.incrementState();
 
             case 1:
-                if (!writer.writeLong("futId", futId))
+                if (!writer.writeByte("flags", flags))
                     return false;
 
                 writer.incrementState();
 
             case 2:
-                if (!writer.writeString("msg", msg))
+                if (!writer.writeLong("futId", futId))
                     return false;
 
                 writer.incrementState();
@@ -201,7 +192,7 @@ public class IgniteDiagnosticMessage implements Message {
 
         switch (reader.state()) {
             case 0:
-                cBytes = reader.readByteArray("cBytes");
+                bytes = reader.readByteArray("bytes");
 
                 if (!reader.isLastRead())
                     return false;
@@ -209,7 +200,7 @@ public class IgniteDiagnosticMessage implements Message {
                 reader.incrementState();
 
             case 1:
-                futId = reader.readLong("futId");
+                flags = reader.readByte("flags");
 
                 if (!reader.isLastRead())
                     return false;
@@ -217,7 +208,7 @@ public class IgniteDiagnosticMessage implements Message {
                 reader.incrementState();
 
             case 2:
-                msg = reader.readString("msg");
+                futId = reader.readLong("futId");
 
                 if (!reader.isLastRead())
                     return false;
@@ -247,7 +238,26 @@ public class IgniteDiagnosticMessage implements Message {
     /**
      *
      */
-    public final static class TxEntriesInfoClosure implements IgniteBiInClosure<StringBuilder, GridKernalContext> {
+    public static abstract class DiagnosticBaseClosure implements IgniteBiInClosure<StringBuilder, GridKernalContext> {
+        /**
+         * @return Key to group similar messages.
+         */
+        public Object mergeKey() {
+            return getClass();
+        }
+
+        /**
+         * @param other Another closure of the same type.
+         */
+        public void merge(DiagnosticBaseClosure other) {
+            // No-op.
+        }
+    }
+
+    /**
+     *
+     */
+    public final static class TxEntriesInfoClosure extends DiagnosticBaseClosure {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -266,12 +276,6 @@ public class IgniteDiagnosticMessage implements Message {
             this.keys = new HashSet<>(keys);
         }
 
-        public void merge(TxEntriesInfoClosure other) {
-            assert other != null && cacheId == other.cacheId : other;
-
-            this.keys.addAll(other.keys);
-        }
-
         /** {@inheritDoc} */
         @Override public void apply(StringBuilder sb, GridKernalContext ctx) {
             sb.append(U.nl());
@@ -305,25 +309,24 @@ public class IgniteDiagnosticMessage implements Message {
         }
 
         /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-            if (o == null || getClass() != o.getClass())
-                return false;
-            TxEntriesInfoClosure closure = (TxEntriesInfoClosure)o;
-            return cacheId == closure.cacheId;
+        @Override public Object mergeKey() {
+            return new T2<>(getClass(), cacheId);
         }
 
         /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return Objects.hash(cacheId);
+        @Override public void merge(DiagnosticBaseClosure other) {
+            TxEntriesInfoClosure other0 = (TxEntriesInfoClosure)other;
+
+            assert other0 != null && cacheId == other0.cacheId : other;
+
+            this.keys.addAll(other0.keys);
         }
     }
 
     /**
      *
      */
-    public final static class ExchangeInfoClosure implements IgniteBiInClosure<StringBuilder, GridKernalContext> {
+    public final static class ExchangeInfoClosure extends DiagnosticBaseClosure {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -355,25 +358,15 @@ public class IgniteDiagnosticMessage implements Message {
         }
 
         /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-            if (o == null || getClass() != o.getClass())
-                return false;
-            ExchangeInfoClosure closure = (ExchangeInfoClosure)o;
-            return Objects.equals(topVer, closure.topVer);
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return Objects.hash(topVer);
+        @Override public Object mergeKey() {
+            return new T2<>(getClass(), topVer);
         }
     }
 
     /**
      *
      */
-    public final static class TxInfoClosure implements IgniteBiInClosure<StringBuilder, GridKernalContext> {
+    public final static class TxInfoClosure extends DiagnosticBaseClosure {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -418,321 +411,8 @@ public class IgniteDiagnosticMessage implements Message {
         }
 
         /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-            if (o == null || getClass() != o.getClass())
-                return false;
-            TxInfoClosure closure = (TxInfoClosure)o;
-            return Objects.equals(dhtVer, closure.dhtVer) &&
-                Objects.equals(nearVer, closure.nearVer);
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return Objects.hash(dhtVer, nearVer);
-        }
-    }
-
-    /**
-     *
-     */
-    private final static class CompoundInfoClosure implements IgniteClosure<GridKernalContext, String> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        protected final UUID nodeId;
-
-        /** */
-        private Set<IgniteBiInClosure<StringBuilder, GridKernalContext>> cls = new HashSet<>();
-
-        /** */
-        private transient Map<Integer, StringBuilder> msgs = new TreeMap<>();
-
-        /**
-         * @param nodeId Local node ID.
-         */
-        CompoundInfoClosure(UUID nodeId) {
-            this.nodeId = nodeId;
-        }
-
-        /** {@inheritDoc} */
-        @Override public final String apply(GridKernalContext ctx) {
-            try {
-                IgniteInternalFuture<String> commInfo = dumpCommunicationInfo(ctx, nodeId);
-
-                StringBuilder sb = new StringBuilder();
-
-                dumpNodeBasicInfo(sb, ctx);
-
-                sb.append(U.nl());
-
-                dumpExchangeInfo(sb, ctx);
-
-                sb.append(U.nl());
-
-                sb.append(commInfo.get(10_000));
-
-                moreInfo(sb, ctx);
-
-                return sb.toString();
-            }
-            catch (Exception e) {
-                ctx.cluster().diagnosticLog().error("Failed to execute diagnostic message closure: " + e, e);
-
-                return "Failed to execute diagnostic message closure: " + e;
-            }
-        }
-
-        /**
-         * @return Node ID.
-         */
-        public UUID nodeId() {
-            return nodeId;
-        }
-
-        /**
-         * @return Initial message.
-         */
-        public String message() {
-            if(msgs.isEmpty())
-                return "";
-
-            StringBuilder sb = new StringBuilder();
-
-            for (StringBuilder b : msgs.values())
-                sb.append(b);
-
-            return sb.toString();
-        }
-
-        /**
-         * @param msg Message.
-         * @param cl Closure.
-         */
-        public void add(String msg, IgniteBiInClosure<StringBuilder, GridKernalContext> cl) {
-            if(msg != null && !msg.isEmpty()) {
-                addMessage(messageType(cl), msg);
-            }
-
-            if (cl == null)
-                return;
-
-            if(!cls.add(cl) && cl.getClass() == TxEntriesInfoClosure.class) {
-                // The entry with the same cache id is already exist, need to merge its keys.
-                TxEntriesInfoClosure cl0 = (TxEntriesInfoClosure)cl;
-                getExisted(cl0.cacheId).merge(cl0);
-            }
-        }
-
-        /**
-         * @param cl Closure.
-         * @return Message type for given closure.
-         */
-        private int messageType(IgniteBiInClosure<StringBuilder, GridKernalContext> cl) {
-            return TypeComparator.INSTANCE.order(cl);
-        }
-
-        /**
-         * @param msgType Message type.
-         * @param msg Message.
-         */
-        private void addMessage(int msgType, String msg) {
-            StringBuilder sb = msgs.get(msgType);
-
-            if(sb == null)
-                msgs.put(msgType, sb = new StringBuilder());
-
-            if(sb.length() != 0)
-                sb.append(U.nl());
-
-            sb.append(msg);
-        }
-
-        /**
-         * @param cacheId Cache ID.
-         * @return Existed closure.
-         */
-        private TxEntriesInfoClosure getExisted(int cacheId) {
-            for (IgniteBiInClosure<StringBuilder, GridKernalContext> cl0 : cls) {
-                if (TxEntriesInfoClosure.class == cl0.getClass() &&
-                    ((TxEntriesInfoClosure)cl0).cacheId == cacheId)
-                    return (TxEntriesInfoClosure)cl0;
-            }
-
-            throw new AssertionError("Existed closure is not found");
-        }
-
-        /**
-         * @param sb String builder.
-         * @param ctx Grid context.
-         */
-        private void moreInfo(StringBuilder sb, GridKernalContext ctx) {
-            ArrayList<IgniteBiInClosure<StringBuilder, GridKernalContext>> cls = new ArrayList<>(this.cls);
-
-            Collections.sort(cls, TypeComparator.INSTANCE);
-
-            for (int i = 0; i < cls.size(); i++) {
-                try {
-                    cls.get(i).apply(sb, ctx);
-                }
-                catch (Exception e) {
-                    ctx.cluster().diagnosticLog().error("Failed to populate diagnostic with additional information: " + e, e);
-
-                    sb.append(U.nl()).append("Failed to populate diagnostic with additional information: ").append(e);
-                }
-            }
-        }
-    }
-
-    /**
-     *
-     */
-    public static final class PreparedRequest {
-        /** */
-        final UUID localNodeId;
-
-        /** */
-        final Map<UUID, CompoundInfoClosure> cls = new HashMap<>();
-
-        /**
-         * @param nodeId Local node ID.
-         */
-        public PreparedRequest(UUID nodeId) {
-            localNodeId = nodeId;
-        }
-
-        /**
-         * @param nodeId Remote node ID.
-         * @param topVer Topology version.
-         * @param msg Initial message.
-         * @return Prepared request.
-         */
-        public PreparedRequest exchangeInfo(UUID nodeId, AffinityTopologyVersion topVer, String msg) {
-            closure(nodeId).add(msg, new ExchangeInfoClosure(topVer));
-
-            return this;
-        }
-
-        /**
-         * @param nodeId Remote node ID.
-         * @param cacheId Cache ID.
-         * @param keys Entry keys.
-         * @param msg Initial message.
-         * @return Prepared request.
-         */
-        public PreparedRequest txKeyInfo(UUID nodeId, int cacheId, Collection<KeyCacheObject> keys, String msg) {
-            closure(nodeId).add(msg, new TxEntriesInfoClosure(cacheId, keys));
-
-            return this;
-        }
-
-        /**
-         * @param nodeId Remote node ID.
-         * @param dhtVer Tx dht version.
-         * @param nearVer Tx near version.
-         * @param msg Initial message.
-         * @return Prepared request.
-         */
-        public PreparedRequest remoteTxInfo(UUID nodeId, GridCacheVersion dhtVer, GridCacheVersion nearVer, String msg) {
-            closure(nodeId).add(msg, new TxInfoClosure(dhtVer, nearVer));
-
-            return this;
-        }
-
-        /**
-         * @param nodeId Remote node ID.
-         * @param msg Initial message.
-         * @return Prepared request.
-         */
-        public PreparedRequest basicInfo(final UUID nodeId, final String msg) {
-            closure(nodeId).add(msg, null);
-
-            return this;
-        }
-
-        /**
-         * @param ctx Grid context.
-         * @return Future.
-         */
-        public IgniteInternalFuture<String> send(GridKernalContext ctx) {
-            IgniteReducer<String, String> reducer = new IgniteReducer<String, String>() {
-                private final StringBuilder sb = new StringBuilder();
-
-                @Override public boolean collect(@Nullable String s) {
-                    if(s != null)
-                        synchronized (sb) {
-                            sb.append(s);
-                        }
-
-                    return true;
-                }
-
-                @Override public String reduce() {
-                    synchronized (sb) {
-                        return sb.toString();
-                    }
-                }
-            };
-
-            GridCompoundFuture<String, String> fut = new GridCompoundFuture<>(reducer);
-
-            for (Map.Entry<UUID, CompoundInfoClosure> entry : cls.entrySet()) {
-                UUID rmtNodeId = entry.getKey();
-                CompoundInfoClosure c = entry.getValue();
-
-                fut.add(ctx.cluster().diagnosticInfo(rmtNodeId, c, c.message()));
-            }
-
-            fut.markInitialized();
-
-            return fut;
-        }
-
-        /**
-         * @param nodeId Remote node ID.
-         * @return Compound closure
-         */
-        private CompoundInfoClosure closure(UUID nodeId) {
-            CompoundInfoClosure cl = cls.get(nodeId);
-
-            if(cl == null)
-                cls.put(nodeId, cl = new CompoundInfoClosure(localNodeId));
-
-            return cl;
-        }
-    }
-
-    /**
-     *
-     */
-    private static final class TypeComparator implements Comparator<IgniteBiInClosure<StringBuilder, GridKernalContext>> {
-        public static final TypeComparator INSTANCE = new TypeComparator();
-
-        /** {@inheritDoc} */
-        @Override public int compare(IgniteBiInClosure<StringBuilder, GridKernalContext> c1, IgniteBiInClosure<StringBuilder, GridKernalContext> c2) {
-            return Integer.compare(order(c1), order(c2));
-        }
-
-        /**
-         * @param cl Closure.
-         * @return Type order.
-         */
-        private int order(IgniteBiInClosure<StringBuilder, GridKernalContext> cl) {
-            if (cl == null)
-                return 0;
-
-            if (cl.getClass() == ExchangeInfoClosure.class)
-                return 1;
-
-            if (cl.getClass() == TxInfoClosure.class)
-                return 2;
-
-            if (cl.getClass() == TxEntriesInfoClosure.class)
-                return 3;
-
-            return Integer.MAX_VALUE;
+        @Override public Object mergeKey() {
+            return new T3<>(getClass(), nearVer, dhtVer);
         }
     }
 
@@ -759,6 +439,7 @@ public class IgniteDiagnosticMessage implements Message {
         sb.append("Partitions exchange info [readyVer=").append(exchMgr.readyAffinityVersion()).append(']').append(U.nl())
             .append("Last initialized exchange future: ").append(fut);
     }
+
     /**
      * @param ctx Context.
      * @param nodeId Target node ID.
@@ -772,14 +453,6 @@ public class IgniteDiagnosticMessage implements Message {
     }
 
     /**
-     * @param nodeId Local node ID.
-     * @return New prepared request.
-     */
-    public static PreparedRequest newRequest(UUID nodeId) {
-        return new PreparedRequest(nodeId);
-    }
-
-    /**
      * @param time Time.
      * @return Time string.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
new file mode 100644
index 0000000..856510a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
@@ -0,0 +1,272 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.typedef.CI1;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.DiagnosticBaseClosure;
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.ExchangeInfoClosure;
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.TxEntriesInfoClosure;
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.TxInfoClosure;
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.dumpCommunicationInfo;
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.dumpExchangeInfo;
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.dumpNodeBasicInfo;
+
+/**
+ * Groups diagnostic closures by node/closure type.
+ */
+public class IgniteDiagnosticPrepareContext {
+    /** */
+    private final UUID locNodeId;
+
+    /** */
+    private final Map<UUID, CompoundInfoClosure> cls = new HashMap<>();
+
+    /**
+     * @param nodeId Local node ID.
+     */
+    public IgniteDiagnosticPrepareContext(UUID nodeId) {
+        locNodeId = nodeId;
+    }
+
+    /**
+     * @param nodeId Remote node ID.
+     * @param topVer Topology version.
+     * @param msg Initial message.
+     */
+    public void exchangeInfo(UUID nodeId, AffinityTopologyVersion topVer, String msg) {
+        closure(nodeId).add(msg, new ExchangeInfoClosure(topVer));
+    }
+
+    /**
+     * @param nodeId Remote node ID.
+     * @param cacheId Cache ID.
+     * @param keys Entry keys.
+     * @param msg Initial message.
+     */
+    public void  txKeyInfo(UUID nodeId, int cacheId, Collection<KeyCacheObject> keys, String msg) {
+        closure(nodeId).add(msg, new TxEntriesInfoClosure(cacheId, keys));
+    }
+
+    /**
+     * @param nodeId Remote node ID.
+     * @param dhtVer Tx dht version.
+     * @param nearVer Tx near version.
+     * @param msg Initial message.
+     */
+    public void remoteTxInfo(UUID nodeId, GridCacheVersion dhtVer, GridCacheVersion nearVer, String msg) {
+        closure(nodeId).add(msg, new TxInfoClosure(dhtVer, nearVer));
+    }
+
+    /**
+     * @param nodeId Remote node ID.
+     * @param msg Initial message.
+     */
+    public void basicInfo(UUID nodeId, String msg) {
+        closure(nodeId).add(msg, null);
+    }
+
+    /**
+     * @param nodeId Remote node ID.
+     * @return Compound closure
+     */
+    private CompoundInfoClosure closure(UUID nodeId) {
+        CompoundInfoClosure cl = cls.get(nodeId);
+
+        if (cl == null)
+            cls.put(nodeId, cl = new CompoundInfoClosure(locNodeId));
+
+        return cl;
+    }
+
+    /**
+     * @param ctx Grid context.
+     * @param lsnr Optional listener (used in test).
+     */
+    public void send(GridKernalContext ctx, @Nullable IgniteInClosure<IgniteInternalFuture<String>> lsnr) {
+        for (Map.Entry<UUID, CompoundInfoClosure> entry : cls.entrySet()) {
+            UUID rmtNodeId = entry.getKey();
+
+            CompoundInfoClosure c = entry.getValue();
+
+            IgniteInternalFuture<String> fut =
+                ctx.cluster().requestDiagnosticInfo(rmtNodeId, c, c.message());
+
+            if (lsnr != null)
+                fut.listen(lsnr);
+
+            listenAndLog(ctx.cluster().diagnosticLog(), fut);
+        }
+    }
+
+    /**
+     * @param log Logger.
+     * @param fut Future.
+     */
+    private void listenAndLog(final IgniteLogger log, IgniteInternalFuture<String> fut) {
+        fut.listen(new CI1<IgniteInternalFuture<String>>() {
+            @Override public void apply(IgniteInternalFuture<String> fut) {
+                synchronized (IgniteDiagnosticPrepareContext.class) {
+                    try {
+                        log.info(fut.get());
+                    }
+                    catch (Exception e) {
+                        U.error(log, "Failed to dump diagnostic info: " + e, e);
+                    }
+                }
+            }
+        });
+    }
+
+    /**
+     *
+     */
+    private final static class CompoundInfoClosure implements IgniteClosure<GridKernalContext, IgniteDiagnosticInfo> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** ID of node sent closure. */
+        protected final UUID nodeId;
+
+        /** Closures to send on remote node. */
+        private Map<Object, IgniteDiagnosticMessage.DiagnosticBaseClosure> cls = new LinkedHashMap<>();
+
+        /** Local message related to remote closures. */
+        private transient Map<Object, List<String>> msgs = new LinkedHashMap<>();
+
+        /**
+         * @param nodeId Node sent closure.
+         */
+        CompoundInfoClosure(UUID nodeId) {
+            this.nodeId = nodeId;
+        }
+
+        /** {@inheritDoc} */
+        @Override public final IgniteDiagnosticInfo apply(GridKernalContext ctx) {
+            try {
+                IgniteInternalFuture<String> commInfo = dumpCommunicationInfo(ctx, nodeId);
+
+                StringBuilder sb = new StringBuilder();
+
+                dumpNodeBasicInfo(sb, ctx);
+
+                sb.append(U.nl());
+
+                dumpExchangeInfo(sb, ctx);
+
+                sb.append(U.nl());
+
+                sb.append(commInfo.get(10_000));
+
+                moreInfo(sb, ctx);
+
+                return new IgniteDiagnosticInfo(sb.toString());
+            }
+            catch (Exception e) {
+                ctx.cluster().diagnosticLog().error("Failed to execute diagnostic message closure: " + e, e);
+
+                return new IgniteDiagnosticInfo("Failed to execute diagnostic message closure: " + e);
+            }
+        }
+
+        /**
+         * @param sb String builder.
+         * @param ctx Grid context.
+         */
+        private void moreInfo(StringBuilder sb, GridKernalContext ctx) {
+            for (DiagnosticBaseClosure c : cls.values()) {
+                try {
+                    c.apply(sb, ctx);
+                }
+                catch (Exception e) {
+                    ctx.cluster().diagnosticLog().error(
+                        "Failed to populate diagnostic with additional information: " + e, e);
+
+                    sb.append(U.nl()).append("Failed to populate diagnostic with additional information: ").append(e);
+                }
+            }
+        }
+
+        /**
+         * @return Node ID.
+         */
+        public UUID nodeId() {
+            return nodeId;
+        }
+
+        /**
+         * @return Initial message.
+         */
+        public String message() {
+            StringBuilder sb = new StringBuilder();
+
+            for (List<String> msgs0 : msgs.values()) {
+                for (String msg : msgs0) {
+                    if (sb.length() > 0)
+                        sb.append('\n');
+
+                    sb.append(msg);
+                }
+            }
+
+            return sb.toString();
+        }
+
+        /**
+         * @param msg Message.
+         * @param c Closure or {@code null} if only basic info is needed.
+         */
+        public void add(String msg, @Nullable DiagnosticBaseClosure c) {
+            Object key = c != null ? c.mergeKey() : getClass();
+
+            List<String> msgs0 = msgs.get(key);
+
+            if (msgs0 == null) {
+                msgs0 = new ArrayList<>();
+
+                msgs.put(key, msgs0);
+            }
+
+            msgs0.add(msg);
+
+            if (c != null) {
+                DiagnosticBaseClosure c0 = cls.get(c.mergeKey());
+
+                if (c0 == null)
+                    cls.put(c.mergeKey(), c);
+                else
+                    c0.merge(c);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 7757644..fec1892 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -952,7 +952,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
                 if (ctx.config().getPlatformConfiguration() != null)
                     startProcessor(new PlatformPluginProcessor(ctx));
 
-                ctx.cluster().initListeners();
+                ctx.cluster().initDiagnosticListeners();
 
                 fillNodeAttributes(clusterProc.updateNotifierEnabled());
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 9a980d8..0fe1a7f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -108,6 +108,9 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
     /** Message ID generator. */
     private static final AtomicLong idGen = new AtomicLong();
 
+    /** */
+    private static final int MAX_STORED_PENDING_MESSAGES = 100;
+
     /** Delay in milliseconds between retries. */
     private long retryDelay;
 
@@ -131,9 +134,6 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
     private boolean depEnabled;
 
     /** */
-    private static final int MAX_STORED_PENDING_MESSAGES = 100;
-
-    /** */
     private final List<GridCacheMessage> pendingMsgs = new ArrayList<>(MAX_STORED_PENDING_MESSAGES);
 
     /**
@@ -242,11 +242,8 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
 
             if (fut != null && !fut.isDone()) {
                 synchronized (pendingMsgs) {
-                    if (pendingMsgs.size() == MAX_STORED_PENDING_MESSAGES)
-                        // remove oldest
-                        pendingMsgs.remove(0);
-
-                    pendingMsgs.add(cacheMsg);
+                    if (pendingMsgs.size() < MAX_STORED_PENDING_MESSAGES)
+                        pendingMsgs.add(cacheMsg);
                 }
 
                 Thread curThread = Thread.currentThread();

http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index e762f46..d418aac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -50,7 +50,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.events.DiscoveryEvent;
 import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
 import org.apache.ignite.internal.IgniteDiagnosticAware;
-import org.apache.ignite.internal.IgniteDiagnosticMessage;
+import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
 import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -103,6 +103,7 @@ import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_IO_DUMP_ON_TIMEOUT;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_PRELOAD_RESEND_TIMEOUT;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT;
 import static org.apache.ignite.IgniteSystemProperties.getLong;
@@ -112,15 +113,13 @@ import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
 import static org.apache.ignite.internal.GridTopic.TOPIC_CACHE;
 import static org.apache.ignite.internal.events.DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT;
 import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
-import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.*;
+import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.nextDumpTimeout;
 import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader.DFLT_PRELOAD_RESEND_TIMEOUT;
 
 /**
  * Partition exchange manager.
  */
 public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedManagerAdapter<K, V> {
-    /** */
-    private final boolean DIAGNOSTIC_ENABLED = IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_DIAGNOSTIC_ENABLED, false);
     /** Exchange history size. */
     private static final int EXCHANGE_HISTORY_SIZE = 1000;
 
@@ -1368,10 +1367,12 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
     }
 
     /**
-     * @param exchTopVer Optional current exchange topology version.
+     * @param exchFut Optional current exchange future.
      * @throws Exception If failed.
      */
-    public void dumpDebugInfo(@Nullable AffinityTopologyVersion exchTopVer) throws Exception {
+    public void dumpDebugInfo(@Nullable GridDhtPartitionsExchangeFuture exchFut) throws Exception {
+        AffinityTopologyVersion exchTopVer = exchFut != null ? exchFut.topologyVersion() : null;
+
         U.warn(diagnosticLog, "Ready affinity version: " + readyTopVer.get());
 
         U.warn(diagnosticLog, "Last exchange future: " + lastInitializedFut);
@@ -1385,8 +1386,11 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                 U.warn(diagnosticLog, ">>> " + fut);
         }
 
-        IgniteDiagnosticMessage.PreparedRequest req =
-            DIAGNOSTIC_ENABLED ? new IgniteDiagnosticMessage.PreparedRequest(cctx.localNodeId()) : null;
+        IgniteDiagnosticPrepareContext diagCtx = cctx.kernalContext().cluster().diagnosticEnabled() ?
+            new IgniteDiagnosticPrepareContext(cctx.localNodeId()) : null;
+
+        if (diagCtx != null && exchFut != null)
+            exchFut.addDiagnosticRequest(diagCtx);
 
         ExchangeFutureSet exchFuts = this.exchFuts;
 
@@ -1398,31 +1402,12 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
             for (GridDhtPartitionsExchangeFuture fut : exchFuts.values()) {
                 U.warn(diagnosticLog, ">>> " + fut.shortInfo());
 
-
-                if (req != null)
-                    fut.prepareRequest(req);
-
                 if (++cnt == 10)
                     break;
             }
         }
 
-        dumpPendingObjects(exchTopVer, req);
-
-        if (req != null) {
-            IgniteInternalFuture<String> fut = req.send(cctx.kernalContext());
-
-            fut.listen(new CI1<IgniteInternalFuture<String>>() {
-                @Override public void apply(IgniteInternalFuture<String> future) {
-                    try {
-                        U.warn(diagnosticLog, future.get());
-                    }
-                    catch (IgniteCheckedException e) {
-                        U.error(diagnosticLog, "Failed to dump remote diagnostic info: " + e, e);
-                    }
-                }
-            });
-        }
+        dumpPendingObjects(exchTopVer, diagCtx);
 
         for (CacheGroupContext grp : cctx.cache().cacheGroups())
             grp.preloader().dumpDebugInfo();
@@ -1431,11 +1416,14 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
 
         cctx.io().dumpPendingMessages();
 
-        if (IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_IO_DUMP_ON_TIMEOUT, false))
+        if (IgniteSystemProperties.getBoolean(IGNITE_IO_DUMP_ON_TIMEOUT, false))
             cctx.gridIO().dumpStats();
 
         if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false))
             U.dumpThreads(diagnosticLog);
+
+        if (diagCtx != null)
+            diagCtx.send(cctx.kernalContext(), null);
     }
 
     /**
@@ -1502,16 +1490,18 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
             if (dumpLongRunningOperations0(timeout)) {
                 nextLongRunningOpsDumpTime = U.currentTimeMillis() + nextDumpTimeout(longRunningOpsDumpStep++, timeout);
 
-                cctx.kernalContext().closure().runLocalSafe(new Runnable() {
-                    @Override public void run() {
-                        try {
-                            dumpDebugInfo();
-                        }
-                        catch (Exception e) {
-                            U.error(diagnosticLog, "Failed to dump debug information: " + e, e);
-                        }
-                    }
-                });
+                if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false)) {
+                    U.warn(log, "Found long running cache operations, dump threads.");
+
+                    U.dumpThreads(log);
+                }
+
+                if (IgniteSystemProperties.getBoolean(IGNITE_IO_DUMP_ON_TIMEOUT, false)) {
+                    U.warn(log, "Found long running cache operations, dump IO statistics.");
+
+                    // Dump IO manager statistics.
+                    cctx.gridIO().dumpStats();
+                }
             }
             else {
                 nextLongRunningOpsDumpTime = 0;
@@ -1543,10 +1533,10 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
 
     /**
      * @param exchTopVer Exchange topology version.
-     * @param req Prepared diagnostic request.
+     * @param diagCtx Diagnostic request.
      */
     private void dumpPendingObjects(@Nullable AffinityTopologyVersion exchTopVer,
-        @Nullable IgniteDiagnosticMessage.PreparedRequest req) {
+        @Nullable IgniteDiagnosticPrepareContext diagCtx) {
         IgniteTxManager tm = cctx.tm();
 
         if (tm != null) {
@@ -1574,23 +1564,23 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
             U.warn(diagnosticLog, "Pending cache futures:");
 
             for (GridCacheFuture<?> fut : mvcc.activeFutures())
-                dumpDiagnosticInfo(fut, req);
+                dumpDiagnosticInfo(fut, diagCtx);
 
             U.warn(diagnosticLog, "Pending atomic cache futures:");
 
             for (GridCacheFuture<?> fut : mvcc.atomicFutures())
-                dumpDiagnosticInfo(fut, req);
+                dumpDiagnosticInfo(fut, diagCtx);
 
             U.warn(diagnosticLog, "Pending data streamer futures:");
 
             for (IgniteInternalFuture<?> fut : mvcc.dataStreamerFutures())
-                dumpDiagnosticInfo(fut, req);
+                dumpDiagnosticInfo(fut, diagCtx);
 
             if (tm != null) {
                 U.warn(diagnosticLog, "Pending transaction deadlock detection futures:");
 
                 for (IgniteInternalFuture<?> fut : tm.deadlockDetectionFutures())
-                    dumpDiagnosticInfo(fut, req);
+                    dumpDiagnosticInfo(fut, diagCtx);
             }
         }
 
@@ -1613,14 +1603,14 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
     /**
      * Logs the future and dumps diagnostic info if needed.
      * @param fut Future.
-     * @param req Prepared diagnostic request.
+     * @param ctx Diagnostic prepare context.
      */
     private void dumpDiagnosticInfo(IgniteInternalFuture<?> fut,
-        @Nullable IgniteDiagnosticMessage.PreparedRequest req) {
+        @Nullable IgniteDiagnosticPrepareContext ctx) {
         U.warn(diagnosticLog, ">>> " + fut);
 
-        if (req != null && fut instanceof IgniteDiagnosticAware)
-            ((IgniteDiagnosticAware)fut).prepareRequest(req);
+        if (ctx != null && fut instanceof IgniteDiagnosticAware)
+            ((IgniteDiagnosticAware)fut).addDiagnosticRequest(ctx);
     }
 
     /**
@@ -1843,7 +1833,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
 
                                     if (nextDumpTime <= U.currentTimeMillis()) {
                                         try {
-                                            dumpDebugInfo(exchFut.topologyVersion());
+                                            dumpDebugInfo(exchFut);
                                         }
                                         catch (Exception e) {
                                             U.error(log, "Failed to dump debug information: " + e, e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index c4dc60f..609e4cf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -37,7 +37,7 @@ import org.apache.ignite.IgniteInterruptedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.IgniteDiagnosticAware;
-import org.apache.ignite.internal.IgniteDiagnosticMessage;
+import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
@@ -1569,7 +1569,7 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareRequest(IgniteDiagnosticMessage.PreparedRequest req) {
+    @Override public void addDiagnosticRequest(IgniteDiagnosticPrepareContext req) {
         if (!isDone()) {
             for (IgniteInternalFuture fut : futures()) {
                 if (!fut.isDone() && fut instanceof MiniFuture) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
index cc77ce0..d3bfb3a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
@@ -28,6 +28,7 @@ import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.IgniteDiagnosticAware;
 import org.apache.ignite.internal.IgniteDiagnosticMessage;
+import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
@@ -769,7 +770,7 @@ public class GridPartitionedSingleGetFuture extends GridCacheFutureAdapter<Objec
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareRequest(IgniteDiagnosticMessage.PreparedRequest req) {
+    @Override public void addDiagnosticRequest(IgniteDiagnosticPrepareContext ctx) {
         if (!isDone()) {
             UUID nodeId;
             AffinityTopologyVersion topVer;
@@ -780,7 +781,7 @@ public class GridPartitionedSingleGetFuture extends GridCacheFutureAdapter<Objec
             }
 
             if (nodeId != null)
-                req.basicInfo(nodeId, "GridPartitionedSingleGetFuture waiting for " +
+                ctx.basicInfo(nodeId, "GridPartitionedSingleGetFuture waiting for " +
                     "response [node=" + nodeId +
                     ", key=" + key +
                     ", futId=" + futId +

http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index a6e63e9..b88eb47 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -31,7 +31,7 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.IgniteDiagnosticAware;
-import org.apache.ignite.internal.IgniteDiagnosticMessage;
+import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
@@ -598,7 +598,7 @@ public final class GridDhtColocatedLockFuture extends GridCacheCompoundIdentityF
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareRequest(IgniteDiagnosticMessage.PreparedRequest req) {
+    @Override public void addDiagnosticRequest(IgniteDiagnosticPrepareContext ctx) {
         if (!isDone()) {
             for (IgniteInternalFuture fut : futures()) {
                 if (!fut.isDone() && isMini(fut)) {
@@ -616,7 +616,7 @@ public final class GridDhtColocatedLockFuture extends GridCacheCompoundIdentityF
                     }
 
                     if (rmtNodeId != null) {
-                        req.txKeyInfo(rmtNodeId, cctx.cacheId(), m.keys,
+                        ctx.txKeyInfo(rmtNodeId, cctx.cacheId(), m.keys,
                             "GridDhtColocatedLockFuture waiting for response [node=" + rmtNodeId +
                             ", cache=" + cctx.name() +
                             ", miniId=" + m.futId +

http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index f8f5020..b0f8431 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -43,7 +43,7 @@ import org.apache.ignite.events.Event;
 import org.apache.ignite.events.EventType;
 import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
 import org.apache.ignite.internal.IgniteDiagnosticAware;
-import org.apache.ignite.internal.IgniteDiagnosticMessage;
+import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
 import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -1025,7 +1025,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
             ", node=" + cctx.localNodeId() + "]. Dumping pending objects that might be the cause: ");
 
         try {
-            cctx.exchange().dumpDebugInfo(topologyVersion());
+            cctx.exchange().dumpDebugInfo(this);
         }
         catch (Exception e) {
             U.error(log, "Failed to dump debug information: " + e, e);
@@ -2156,7 +2156,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
     }
 
     /** {@inheritDoc} */
-    @Override public void prepareRequest(IgniteDiagnosticMessage.PreparedRequest req) {
+    @Override public void addDiagnosticRequest(IgniteDiagnosticPrepareContext diagCtx) {
         if (!isDone()) {
             ClusterNode crd;
             Set<UUID> remaining;
@@ -2168,13 +2168,13 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
 
             if (crd != null) {
                 if (!crd.isLocal()) {
-                    req.exchangeInfo(crd.id(), topologyVersion(), "Exchange future waiting for coordinator " +
+                    diagCtx.exchangeInfo(crd.id(), topologyVersion(), "Exchange future waiting for coordinator " +
                         "response [crd=" + crd.id() + ", topVer=" + topologyVersion() + ']');
                 }
                 else if (!remaining.isEmpty()){
                     UUID nodeId = remaining.iterator().next();
 
-                    req.exchangeInfo(crd.id(), topologyVersion(), "Exchange future waiting for server " +
+                    diagCtx.exchangeInfo(crd.id(), topologyVersion(), "Exchange future waiting for server " +
                         "response [node=" + nodeId + ", topVer=" + topologyVersion() + ']');
                 }
             }
@@ -2194,17 +2194,14 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
     /** {@inheritDoc} */
     @Override public String toString() {
         Set<UUID> remaining;
-        List<ClusterNode> srvNodes;
 
         synchronized (this) {
             remaining = new HashSet<>(this.remaining);
-            srvNodes = this.srvNodes != null ? new ArrayList<>(this.srvNodes) : null;
         }
 
         return S.toString(GridDhtPartitionsExchangeFuture.class, this,
             "evtLatch", evtLatch == null ? "null" : evtLatch.getCount(),
             "remaining", remaining,
-            "srvNodes", srvNodes,
             "super", super.toString());
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
index b89f00d..b32a325 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
@@ -30,11 +30,11 @@ import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.events.DiscoveryEvent;
 import org.apache.ignite.events.Event;
 import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteDiagnosticInfo;
 import org.apache.ignite.internal.IgniteDiagnosticMessage;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteKernal;
@@ -55,10 +55,13 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
 import org.apache.ignite.spi.discovery.DiscoveryDataBag;
 import org.apache.ignite.spi.discovery.DiscoveryDataBag.GridDiscoveryData;
 import org.jetbrains.annotations.Nullable;
 
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_DIAGNOSTIC_ENABLED;
+import static org.apache.ignite.IgniteSystemProperties.getBoolean;
 import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
 import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
 import static org.apache.ignite.internal.GridComponent.DiscoveryDataExchangeType.CLUSTER_PROC;
@@ -109,9 +112,19 @@ public class ClusterProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * @return Diagnostic flag.
+     */
+    public boolean diagnosticEnabled() {
+        return getBoolean(IGNITE_DIAGNOSTIC_ENABLED, true);
+    }
+
+    /** */
+    private final JdkMarshaller marsh = new JdkMarshaller();
+
+    /**
      * @throws IgniteCheckedException If failed.
      */
-    public void initListeners() throws IgniteCheckedException {
+    public void initDiagnosticListeners() throws IgniteCheckedException {
         ctx.event().addLocalEventListener(new GridLocalEventListener() {
                 @Override public void onEvent(Event evt) {
                     assert evt instanceof DiscoveryEvent;
@@ -126,7 +139,7 @@ public class ClusterProcessor extends GridProcessorAdapter {
                     if (futs != null) {
                         for (InternalDiagnosticFuture fut : futs.values()) {
                             if (fut.nodeId.equals(nodeId))
-                                fut.onDone("Target node failed: " + nodeId);
+                                fut.onDone(new IgniteDiagnosticInfo("Target node failed: " + nodeId));
                         }
                     }
                 }
@@ -150,22 +163,32 @@ public class ClusterProcessor extends GridProcessorAdapter {
                             return;
                         }
 
-                        String resMsg;
+                        byte[] diagRes;
 
-                        IgniteClosure<GridKernalContext, String> c;
+                        IgniteClosure<GridKernalContext, IgniteDiagnosticInfo> c;
 
                         try {
-                            c = msg0.unmarshalClosure(ctx);
+                            c = msg0.unmarshal(marsh);
 
-                            resMsg = c.apply(ctx);
+                            diagRes = marsh.marshal(c.apply(ctx));
                         }
                         catch (Exception e) {
                             U.error(diagnosticLog, "Failed to run diagnostic closure: " + e, e);
 
-                            resMsg = "Failed to run diagnostic closure: " + e;
+                            try {
+                                IgniteDiagnosticInfo errInfo =
+                                    new IgniteDiagnosticInfo("Failed to run diagnostic closure: " + e);
+
+                                diagRes = marsh.marshal(errInfo);
+                            }
+                            catch (Exception e0) {
+                                U.error(diagnosticLog, "Failed to marshal diagnostic closure result: " + e, e);
+
+                                diagRes = null;
+                            }
                         }
 
-                        IgniteDiagnosticMessage res = IgniteDiagnosticMessage.createResponse(resMsg, msg0.futureId());
+                        IgniteDiagnosticMessage res = IgniteDiagnosticMessage.createResponse(diagRes, msg0.futureId());
 
                         try {
                             ctx.io().sendToGridTopic(node, TOPIC_INTERNAL_DIAGNOSTIC, res, GridIoPolicy.SYSTEM_POOL);
@@ -183,8 +206,23 @@ public class ClusterProcessor extends GridProcessorAdapter {
                     else {
                         InternalDiagnosticFuture fut = diagnosticFuturesMap().get(msg0.futureId());
 
-                        if (fut != null)
-                            fut.onResponse(msg0);
+                        if (fut != null) {
+                            IgniteDiagnosticInfo res;
+
+                            try {
+                                res = msg0.unmarshal(marsh);
+
+                                if (res == null)
+                                    res = new IgniteDiagnosticInfo("Remote node failed to marshal response.");
+                            }
+                            catch (Exception e) {
+                                U.error(diagnosticLog, "Failed to unmarshal diagnostic response: " + e, e);
+
+                                res = new IgniteDiagnosticInfo("Failed to unmarshal diagnostic response: " + e);
+                            }
+
+                            fut.onResponse(res);
+                        }
                         else
                             U.warn(diagnosticLog, "Failed to find diagnostic message future [msg=" + msg0 + ']');
                     }
@@ -334,60 +372,27 @@ public class ClusterProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * Send diagnostic message closure to remote node. When response received dumps
+     * remote message and local communication info about connection(s) with remote node.
+     *
      * @param nodeId Target node ID.
-     * @param msg Local message to log.
-     */
-    public void dumpBasicInfo(final UUID nodeId, final String msg,
-        @Nullable IgniteInClosure<IgniteInternalFuture<String>> lsnr) {
-        if (!IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_DIAGNOSTIC_ENABLED, false))
-            return;
-
-        IgniteInternalFuture<String> fut = IgniteDiagnosticMessage
-            .newRequest(ctx.localNodeId())
-            .basicInfo(nodeId, msg)
-            .send(ctx);
-
-        if (lsnr != null)
-            fut.listen(lsnr);
-
-        listenAndLog(fut);
-    }
-
-    /**
-     * @param fut Future.
-     */
-    private void listenAndLog(IgniteInternalFuture<String> fut) {
-        fut.listen(new CI1<IgniteInternalFuture<String>>() {
-            @Override public void apply(IgniteInternalFuture<String> fut) {
-                try {
-                    diagnosticLog.info(fut.get());
-                }
-                catch (Exception e) {
-                    U.error(diagnosticLog, "Failed to dump diagnostic info: " + e, e);
-                }
-            }
-        });
-    }
-
-    /**
-     * @param nodeId Target node ID.
-     * @param c Closure.
+     * @param c Closure to send.
      * @param baseMsg Local message to log.
      * @return Message future.
      */
-    public IgniteInternalFuture<String> diagnosticInfo(final UUID nodeId,
-        IgniteClosure<GridKernalContext, String> c,
+    public IgniteInternalFuture<String> requestDiagnosticInfo(final UUID nodeId,
+        IgniteClosure<GridKernalContext, IgniteDiagnosticInfo> c,
         final String baseMsg) {
         final GridFutureAdapter<String> infoFut = new GridFutureAdapter<>();
 
-        final IgniteInternalFuture<String> rmtFut = sendDiagnosticMessage(nodeId, c);
+        final IgniteInternalFuture<IgniteDiagnosticInfo> rmtFut = sendDiagnosticMessage(nodeId, c);
 
-        rmtFut.listen(new CI1<IgniteInternalFuture<String>>() {
-            @Override public void apply(IgniteInternalFuture<String> fut) {
+        rmtFut.listen(new CI1<IgniteInternalFuture<IgniteDiagnosticInfo>>() {
+            @Override public void apply(IgniteInternalFuture<IgniteDiagnosticInfo> fut) {
                 String rmtMsg;
 
                 try {
-                    rmtMsg = fut.get();
+                    rmtMsg = fut.get().message();
                 }
                 catch (Exception e) {
                     rmtMsg = "Diagnostic processing error: " + e;
@@ -427,9 +432,10 @@ public class ClusterProcessor extends GridProcessorAdapter {
      * @param c Message closure.
      * @return Message future.
      */
-    private IgniteInternalFuture<String> sendDiagnosticMessage(UUID nodeId, IgniteClosure<GridKernalContext, String> c) {
+    private IgniteInternalFuture<IgniteDiagnosticInfo> sendDiagnosticMessage(UUID nodeId,
+        IgniteClosure<GridKernalContext, IgniteDiagnosticInfo> c) {
         try {
-            IgniteDiagnosticMessage msg = IgniteDiagnosticMessage.createRequest(ctx,
+            IgniteDiagnosticMessage msg = IgniteDiagnosticMessage.createRequest(marsh,
                 c,
                 diagFutId.getAndIncrement());
 
@@ -442,9 +448,9 @@ public class ClusterProcessor extends GridProcessorAdapter {
             return fut;
         }
         catch (Exception e) {
-            U.error(log, "Failed to send diagnostic message: " + e);
+            U.error(diagnosticLog, "Failed to send diagnostic message: " + e);
 
-            return new GridFinishedFuture<>("Failed to send diagnostic message: " + e);
+            return new GridFinishedFuture<>(new IgniteDiagnosticInfo("Failed to send diagnostic message: " + e));
         }
     }
 
@@ -534,7 +540,7 @@ public class ClusterProcessor extends GridProcessorAdapter {
     /**
      *
      */
-    class InternalDiagnosticFuture extends GridFutureAdapter<String> {
+    class InternalDiagnosticFuture extends GridFutureAdapter<IgniteDiagnosticInfo> {
         /** */
         private final long id;
 
@@ -542,6 +548,7 @@ public class ClusterProcessor extends GridProcessorAdapter {
         private final UUID nodeId;
 
         /**
+         * @param nodeId Target node ID.
          * @param id Future ID.
          */
         InternalDiagnosticFuture(UUID nodeId, long id) {
@@ -550,14 +557,14 @@ public class ClusterProcessor extends GridProcessorAdapter {
         }
 
         /**
-         * @param msg Response message.
+         * @param res Response.
          */
-        public void onResponse(IgniteDiagnosticMessage msg) {
-            onDone(msg.message());
+        public void onResponse(IgniteDiagnosticInfo res) {
+            onDone(res);
         }
 
         /** {@inheritDoc} */
-        @Override public boolean onDone(@Nullable String res, @Nullable Throwable err) {
+        @Override public boolean onDone(@Nullable IgniteDiagnosticInfo res, @Nullable Throwable err) {
             if (super.onDone(res, err)) {
                 diagnosticFuturesMap().remove(id);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteDiagnosticMessagesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteDiagnosticMessagesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteDiagnosticMessagesTest.java
index 95f7513..d308fcc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteDiagnosticMessagesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteDiagnosticMessagesTest.java
@@ -19,11 +19,11 @@ package org.apache.ignite.internal.managers;
 
 import java.util.concurrent.ThreadLocalRandom;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -55,12 +55,11 @@ public class IgniteDiagnosticMessagesTest extends GridCommonAbstractTest {
 
         cfg.setClientMode(client);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
         ccfg.setCacheMode(CacheMode.REPLICATED);
         ccfg.setAtomicityMode(TRANSACTIONAL);
-        ccfg.setName("c1");
 
         cfg.setCacheConfiguration(ccfg);
 
@@ -71,8 +70,6 @@ public class IgniteDiagnosticMessagesTest extends GridCommonAbstractTest {
     @Override protected void beforeTestsStarted() throws Exception {
         super.beforeTestsStarted();
 
-        System.setProperty(IgniteSystemProperties.IGNITE_DIAGNOSTIC_ENABLED, "true");
-
         startGrids(3);
 
         client = true;
@@ -84,8 +81,6 @@ public class IgniteDiagnosticMessagesTest extends GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void afterTestsStopped() throws Exception {
-        System.setProperty(IgniteSystemProperties.IGNITE_DIAGNOSTIC_ENABLED, "false");
-
         stopAllGrids();
 
         super.afterTestsStopped();
@@ -100,7 +95,7 @@ public class IgniteDiagnosticMessagesTest extends GridCommonAbstractTest {
         sendDiagnostic();
 
         for (int i = 0; i < 5; i++) {
-            final IgniteCache cache = ignite(i).cache("c1");
+            final IgniteCache cache = ignite(i).cache(DEFAULT_CACHE_NAME);
 
             GridTestUtils.runMultiThreaded(new Runnable() {
                 @Override public void run() {
@@ -126,18 +121,20 @@ public class IgniteDiagnosticMessagesTest extends GridCommonAbstractTest {
 
                     final GridFutureAdapter<String> fut = new GridFutureAdapter<>();
 
-                    node.context().cluster().dumpBasicInfo(dstNode.id(), "Test diagnostic",
-                        new IgniteInClosure<IgniteInternalFuture<String>>() {
-                            @Override public void apply(IgniteInternalFuture<String> diagFut) {
-                                try {
-                                    fut.onDone(diagFut.get());
-                                }
-                                catch (Exception e) {
-                                    fut.onDone(e);
-                                }
+                    IgniteDiagnosticPrepareContext ctx = new IgniteDiagnosticPrepareContext(node.getLocalNodeId());
+
+                    ctx.basicInfo(dstNode.id(), "Test diagnostic");
+
+                    ctx.send(node.context(), new IgniteInClosure<IgniteInternalFuture<String>>() {
+                        @Override public void apply(IgniteInternalFuture<String> diagFut) {
+                            try {
+                                fut.onDone(diagFut.get());
+                            }
+                            catch (Exception e) {
+                                fut.onDone(e);
                             }
                         }
-                    );
+                    });
 
                     String msg = fut.get();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/acf211cf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 3305058..cc25aca 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -35,6 +35,8 @@ import org.apache.ignite.internal.GridStopWithCancelSelfTest;
 import org.apache.ignite.internal.IgniteLocalNodeMapBeforeStartTest;
 import org.apache.ignite.internal.IgniteSlowClientDetectionSelfTest;
 import org.apache.ignite.internal.MarshallerContextLockingSelfTest;
+import org.apache.ignite.internal.managers.IgniteDiagnosticMessagesMultipleConnectionsTest;
+import org.apache.ignite.internal.managers.IgniteDiagnosticMessagesTest;
 import org.apache.ignite.internal.processors.affinity.GridAffinityProcessorRendezvousSelfTest;
 import org.apache.ignite.internal.processors.cache.GridLocalIgniteSerializationTest;
 import org.apache.ignite.internal.processors.cache.GridProjectionForCachesOnDaemonNodeSelfTest;
@@ -52,8 +54,8 @@ import org.apache.ignite.internal.processors.database.BPlusTreeSelfTest;
 import org.apache.ignite.internal.processors.database.FreeListImplSelfTest;
 import org.apache.ignite.internal.processors.database.MemoryMetricsSelfTest;
 import org.apache.ignite.internal.processors.database.MetadataStorageSelfTest;
-import org.apache.ignite.internal.processors.odbc.OdbcEscapeSequenceSelfTest;
 import org.apache.ignite.internal.processors.odbc.OdbcConfigurationValidationSelfTest;
+import org.apache.ignite.internal.processors.odbc.OdbcEscapeSequenceSelfTest;
 import org.apache.ignite.internal.processors.service.ClosureServiceClientsNodesTest;
 import org.apache.ignite.internal.product.GridProductVersionSelfTest;
 import org.apache.ignite.internal.util.nio.IgniteExceptionInNioWorkerSelfTest;
@@ -173,6 +175,10 @@ public class IgniteBasicTestSuite extends TestSuite {
 
         suite.addTestSuite(IgniteMarshallerCacheClassNameConflictTest.class);
         suite.addTestSuite(IgniteMarshallerCacheClientRequestsMappingOnMissTest.class);
+
+        suite.addTestSuite(IgniteDiagnosticMessagesTest.class);
+        suite.addTestSuite(IgniteDiagnosticMessagesMultipleConnectionsTest.class);
+
         return suite;
     }
 }


Mime
View raw message