You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by se...@apache.org on 2014/11/04 04:51:39 UTC

[1/2] git commit: STORM-497: don't modify the mapping while the someone could be reading it.

Repository: storm
Updated Branches:
  refs/heads/master 5a460384f -> a73a74aab


STORM-497: don't modify the mapping while the someone could be reading it.


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

Branch: refs/heads/master
Commit: f259f1da288171a9393fb500150d034ccca0d146
Parents: 5aae768
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Wed Sep 17 13:07:42 2014 +0000
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Wed Sep 17 13:07:42 2014 +0000

----------------------------------------------------------------------
 .../jvm/backtype/storm/messaging/netty/Server.java    | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/f259f1da/storm-core/src/jvm/backtype/storm/messaging/netty/Server.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/messaging/netty/Server.java b/storm-core/src/jvm/backtype/storm/messaging/netty/Server.java
index 20a147d..2499e65 100644
--- a/storm-core/src/jvm/backtype/storm/messaging/netty/Server.java
+++ b/storm-core/src/jvm/backtype/storm/messaging/netty/Server.java
@@ -56,7 +56,7 @@ class Server implements IConnection {
     final ServerBootstrap bootstrap;
     
     private int queueCount;
-    HashMap<Integer, Integer> taskToQueueId = null;
+    private volatile HashMap<Integer, Integer> taskToQueueId = null;
     int roundRobinQueueId;
 	
     boolean closing = false;
@@ -131,18 +131,18 @@ class Server implements IConnection {
     
     private Integer getMessageQueueId(int task) {
       // try to construct the map from taskId -> queueId in round robin manner.
-      
       Integer queueId = taskToQueueId.get(task);
       if (null == queueId) {
-        synchronized(taskToQueueId) {
-          //assgin task to queue in round-robin manner
-          if (null == taskToQueueId.get(task)) {
+        synchronized (this) {
+          queueId = taskToQueueId.get(task);
+          if (queueId == null) {
             queueId = roundRobinQueueId++;
-            
-            taskToQueueId.put(task, queueId);
             if (roundRobinQueueId == queueCount) {
               roundRobinQueueId = 0;
             }
+            HashMap<Integer, Integer> newRef = new HashMap<Integer, Integer>(taskToQueueId);
+            newRef.put(task, queueId);
+            taskToQueueId = newRef;
           }
         }
       }


[2/2] git commit: Merge branch 'STORM-497' of https://github.com/revans2/incubator-storm into storm-497

Posted by se...@apache.org.
Merge branch 'STORM-497' of https://github.com/revans2/incubator-storm into storm-497


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

Branch: refs/heads/master
Commit: a73a74aab09c42398994fcfbbde55109a0c10001
Parents: 5a46038 f259f1d
Author: root <root@IDHV22-04.(none)>
Authored: Tue Nov 4 09:26:26 2014 +0800
Committer: root <root@IDHV22-04.(none)>
Committed: Tue Nov 4 09:26:26 2014 +0800

----------------------------------------------------------------------
 .../jvm/backtype/storm/messaging/netty/Server.java    | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------