ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [6/7] ignite git commit: Added ability to dump direct message reader and writer
Date Tue, 22 Mar 2016 17:36:48 GMT
Added ability to dump direct message reader and writer


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

Branch: refs/heads/ignite-2801
Commit: 660aa2f7b3948d34f20baac516d29e43984f4ede
Parents: f76a313
Author: Yakov Zhdanov <yzhdanov@gridgain.com>
Authored: Tue Mar 22 17:03:03 2016 +0300
Committer: Yakov Zhdanov <yzhdanov@gridgain.com>
Committed: Tue Mar 22 17:03:03 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/direct/DirectMessageReader.java      | 11 +++++++++++
 .../ignite/internal/direct/DirectMessageWriter.java      | 11 +++++++++++
 .../ignite/internal/direct/state/DirectMessageState.java |  9 +++++++++
 .../direct/stream/v1/DirectByteBufferStreamImplV1.java   |  6 ++++++
 .../direct/stream/v2/DirectByteBufferStreamImplV2.java   |  8 ++++++++
 .../ignite/internal/util/nio/GridDirectParser.java       |  4 ++--
 .../apache/ignite/internal/util/nio/GridNioServer.java   |  6 ++++++
 7 files changed, 53 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/660aa2f7/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java
b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java
index e0b7b22..323d142 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.direct.state.DirectMessageStateItem;
 import org.apache.ignite.internal.direct.stream.DirectByteBufferStream;
 import org.apache.ignite.internal.direct.stream.v1.DirectByteBufferStreamImplV1;
 import org.apache.ignite.internal.direct.stream.v2.DirectByteBufferStreamImplV2;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.lang.IgniteOutClosure;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.plugin.extensions.communication.Message;
@@ -373,6 +374,11 @@ public class DirectMessageReader implements MessageReader {
         state.reset();
     }
 
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(DirectMessageReader.class, this);
+    }
+
     /**
      */
     private static class StateItem implements DirectMessageStateItem {
@@ -407,5 +413,10 @@ public class DirectMessageReader implements MessageReader {
         @Override public void reset() {
             state = 0;
         }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(StateItem.class, this);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/660aa2f7/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
index c960ad4..c381711 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.direct.state.DirectMessageStateItem;
 import org.apache.ignite.internal.direct.stream.DirectByteBufferStream;
 import org.apache.ignite.internal.direct.stream.v1.DirectByteBufferStreamImplV1;
 import org.apache.ignite.internal.direct.stream.v2.DirectByteBufferStreamImplV2;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.lang.IgniteOutClosure;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.plugin.extensions.communication.Message;
@@ -332,6 +333,11 @@ public class DirectMessageWriter implements MessageWriter {
         state.reset();
     }
 
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(DirectMessageWriter.class, this);
+    }
+
     /**
      */
     private static class StateItem implements DirectMessageStateItem {
@@ -369,5 +375,10 @@ public class DirectMessageWriter implements MessageWriter {
             state = 0;
             hdrWritten = false;
         }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(StateItem.class, this);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/660aa2f7/modules/core/src/main/java/org/apache/ignite/internal/direct/state/DirectMessageState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/state/DirectMessageState.java
b/modules/core/src/main/java/org/apache/ignite/internal/direct/state/DirectMessageState.java
index a61bb30..58f625f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/state/DirectMessageState.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/state/DirectMessageState.java
@@ -18,6 +18,9 @@
 package org.apache.ignite.internal.direct.state;
 
 import java.lang.reflect.Array;
+import java.util.Arrays;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.lang.IgniteOutClosure;
 
 /**
@@ -28,6 +31,7 @@ public class DirectMessageState<T extends DirectMessageStateItem>
{
     private static final int INIT_SIZE = 10;
 
     /** Item factory. */
+    @GridToStringExclude
     private final IgniteOutClosure<T> factory;
 
     /** Stack array. */
@@ -95,4 +99,9 @@ public class DirectMessageState<T extends DirectMessageStateItem>
{
 
         stack[0].reset();
     }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(DirectMessageState.class, this, "stack", Arrays.toString(stack));
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/660aa2f7/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v1/DirectByteBufferStreamImplV1.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v1/DirectByteBufferStreamImplV1.java
b/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v1/DirectByteBufferStreamImplV1.java
index 2ca3a23..9b21058 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v1/DirectByteBufferStreamImplV1.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v1/DirectByteBufferStreamImplV1.java
@@ -28,6 +28,7 @@ import java.util.NoSuchElementException;
 import java.util.UUID;
 import org.apache.ignite.internal.direct.stream.DirectByteBufferStream;
 import org.apache.ignite.internal.util.GridUnsafe;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.plugin.extensions.communication.Message;
@@ -1349,6 +1350,11 @@ public class DirectByteBufferStreamImplV1 implements DirectByteBufferStream
{
         };
     }
 
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(DirectByteBufferStreamImplV1.class, this);
+    }
+
     /**
      * Array creator.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/660aa2f7/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
b/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
index 489e7e1..97da92d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
@@ -29,6 +29,8 @@ import java.util.RandomAccess;
 import java.util.UUID;
 import org.apache.ignite.internal.direct.stream.DirectByteBufferStream;
 import org.apache.ignite.internal.util.GridUnsafe;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.plugin.extensions.communication.Message;
@@ -218,6 +220,7 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream
{
     private static final Object NULL = new Object();
 
     /** */
+    @GridToStringExclude
     private final MessageFactory msgFactory;
 
     /** */
@@ -1572,6 +1575,11 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream
{
         }
     }
 
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(DirectByteBufferStreamImplV2.class, this);
+    }
+
     /**
      * Array creator.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/660aa2f7/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
index aa88808..aaa7f3d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
@@ -31,10 +31,10 @@ import org.jetbrains.annotations.Nullable;
  */
 public class GridDirectParser implements GridNioParser {
     /** Message metadata key. */
-    private static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+    static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
 
     /** Reader metadata key. */
-    private static final int READER_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+    static final int READER_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
 
     /** */
     private final MessageFactory msgFactory;

http://git-wip-us.apache.org/repos/asf/ignite/blob/660aa2f7/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index b07ae19..3ae8312 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -62,6 +62,7 @@ import org.apache.ignite.lang.IgniteBiInClosure;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 import org.apache.ignite.thread.IgniteThread;
 import org.jetbrains.annotations.Nullable;
@@ -1423,9 +1424,14 @@ public class GridNioServer<T> {
                                 for (SelectionKey key : keys) {
                                     GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
 
+                                    MessageWriter writer = ses.meta(MSG_WRITER.ordinal());
+                                    MessageReader reader = ses.meta(GridDirectParser.READER_META_KEY);
+
                                     sb.append("    Connection info [")
                                         .append("rmtAddr=").append(ses.remoteAddress())
                                         .append(", locAddr=").append(ses.localAddress())
+                                        .append(", msgWriter=").append(writer != null ? writer.toString()
: "null")
+                                        .append(", msgReader=").append(reader != null ? reader.toString()
: "null")
                                         .append(", bytesRcvd=").append(ses.bytesReceived())
                                         .append(", bytesSent=").append(ses.bytesSent());
 


Mime
View raw message