ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-4154
Date Tue, 01 Nov 2016 06:59:01 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-4154 577680984 -> bd28b16ac


ignite-4154


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

Branch: refs/heads/ignite-4154
Commit: bd28b16acee8b0e4005882fc58415c9ca46ec218
Parents: 5776809
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Nov 1 09:58:48 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Nov 1 09:58:48 2016 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 48 +++++++++++++++++++-
 1 file changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bd28b16a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index f667cc8..116300b 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -2004,7 +2004,7 @@ class ServerImpl extends TcpDiscoveryImpl {
         /** Discarded message ID. */
         private IgniteUuid discardId;
 
-        /** Discarded message ID. */
+        /** Discarded custom message ID. */
         private IgniteUuid customDiscardId;
 
         /**
@@ -2044,18 +2044,64 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             this.discardId = discardId;
             this.customDiscardId = customDiscardId;
+
+            cleanup();
         }
 
         /**
          * Discards message with provided ID and all before it.
          *
          * @param id Discarded message ID.
+         * @param custom {@code True} if discard for {@link TcpDiscoveryCustomEventMessage}.
          */
         void discard(IgniteUuid id, boolean custom) {
             if (custom)
                 customDiscardId = id;
             else
                 discardId = id;
+
+            cleanup();
+        }
+
+        /**
+         *
+         */
+        void cleanup() {
+            Iterator<TcpDiscoveryAbstractMessage> msgIt = msgs.iterator();
+
+            boolean skipMsg = discardId != null;
+            boolean skipCustomMsg = customDiscardId != null;
+
+            while (msgIt.hasNext()) {
+                TcpDiscoveryAbstractMessage msg0 = msgIt.next();
+
+                if (msg0 instanceof TcpDiscoveryCustomEventMessage) {
+                    if (skipCustomMsg) {
+                        assert customDiscardId != null;
+
+                        if (F.eq(customDiscardId, msg0.id()))
+                            skipCustomMsg = false;
+                        else
+                            msgIt.remove();
+
+                        continue;
+                    }
+                }
+                else {
+                    if (skipMsg) {
+                        assert discardId != null;
+
+                        if (F.eq(discardId, msg0.id()))
+                            skipMsg = false;
+                        else
+                            msgIt.remove();
+
+                        continue;
+                    }
+                }
+
+                break;
+            }
         }
 
         /**


Mime
View raw message