ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [44/50] [abbrv] incubator-ignite git commit: # IGNITE-777 (ConcurrentModificationException in TcpDiscoverySpi): Clone message before send to client.
Date Tue, 12 May 2015 10:35:34 GMT
# IGNITE-777 (ConcurrentModificationException in TcpDiscoverySpi): Clone message before send
to client.


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

Branch: refs/heads/ignite-695
Commit: 0dc908bd3d781c30b809d3ba525208d583d8c35d
Parents: c9cd92e
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Wed Apr 22 13:29:40 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Fri May 8 17:58:11 2015 +0300

----------------------------------------------------------------------
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 24 ++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0dc908bd/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 46d90b5..3afcd0f 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -2690,8 +2690,28 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
                 msgLsnr.apply(msg);
 
             if (redirectToClients(msg)) {
-                for (ClientMessageWorker clientMsgWorker : clientMsgWorkers.values())
-                    clientMsgWorker.addMessage(msg);
+                byte[] marshalledMsg = null;
+
+                for (ClientMessageWorker clientMsgWorker : clientMsgWorkers.values()) {
+                    // Send a clone to client to avoid ConcurrentModificationException
+                    TcpDiscoveryAbstractMessage msgClone;
+
+                    try {
+                        if (marshalledMsg == null)
+                            marshalledMsg = marsh.marshal(msg);
+
+                        msgClone = marsh.unmarshal(marshalledMsg, null);
+
+                        clientMsgWorker.addMessage(msgClone);
+                    }
+                    catch (IgniteCheckedException e) {
+                        log.error("Failed to marshal message: " + msg, e);
+
+                        msgClone = msg;
+                    }
+
+                    clientMsgWorker.addMessage(msgClone);
+                }
             }
 
             Collection<TcpDiscoveryNode> failedNodes;


Mime
View raw message