Repository: giraph Updated Branches: refs/heads/trunk 251b167e9 -> d16b6b8ce
GIRAPH-1182 closes #66 Project: http://git-wip-us.apache.org/repos/asf/giraph/repo Commit: http://git-wip-us.apache.org/repos/asf/giraph/commit/d16b6b8c Tree: http://git-wip-us.apache.org/repos/asf/giraph/tree/d16b6b8c Diff: http://git-wip-us.apache.org/repos/asf/giraph/diff/d16b6b8c Branch: refs/heads/trunk Commit: d16b6b8ce843e6e931cb8dbc92823f82ab10ce0d Parents: 251b167 Author: Maja Kabiljo <majakabi...@fb.com> Authored: Thu Mar 22 12:52:55 2018 -0700 Committer: Maja Kabiljo <majakabi...@fb.com> Committed: Thu Mar 22 14:11:52 2018 -0700 ---------------------------------------------------------------------- .../org/apache/giraph/comm/netty/ChannelRotater.java | 11 +++++++++-- .../java/org/apache/giraph/comm/netty/NettyClient.java | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/giraph/blob/d16b6b8c/giraph-core/src/main/java/org/apache/giraph/comm/netty/ChannelRotater.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/comm/netty/ChannelRotater.java b/giraph-core/src/main/java/org/apache/giraph/comm/netty/ChannelRotater.java index b9e806d..54c0b50 100644 --- a/giraph-core/src/main/java/org/apache/giraph/comm/netty/ChannelRotater.java +++ b/giraph-core/src/main/java/org/apache/giraph/comm/netty/ChannelRotater.java @@ -18,6 +18,7 @@ package org.apache.giraph.comm.netty; +import java.net.InetSocketAddress; import java.util.List; import com.google.common.collect.Lists; @@ -36,14 +37,18 @@ public class ChannelRotater { private final List<Channel> channelList = Lists.newArrayList(); /** Task id of this channel */ private final Integer taskId; + /** Address these channels are associated with */ + private final InetSocketAddress address; /** * Constructor * * @param taskId Id of the task these channels as associated with + * @param address Address these channels are associated with */ - public ChannelRotater(Integer taskId) { + public ChannelRotater(Integer taskId, InetSocketAddress address) { this.taskId = taskId; + this.address = address; } public Integer getTaskId() { @@ -68,7 +73,9 @@ public class ChannelRotater { */ public synchronized Channel nextChannel() { if (channelList.isEmpty()) { - throw new IllegalArgumentException("nextChannel: No channels exist!"); + throw new IllegalArgumentException( + "nextChannel: No channels exist for hostname " + + address.getHostName()); } ++index; http://git-wip-us.apache.org/repos/asf/giraph/blob/d16b6b8c/giraph-core/src/main/java/org/apache/giraph/comm/netty/NettyClient.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/comm/netty/NettyClient.java b/giraph-core/src/main/java/org/apache/giraph/comm/netty/NettyClient.java index 7b751ed..2c38505 100644 --- a/giraph-core/src/main/java/org/apache/giraph/comm/netty/NettyClient.java +++ b/giraph-core/src/main/java/org/apache/giraph/comm/netty/NettyClient.java @@ -533,7 +533,8 @@ public class NettyClient { addressChannelMap.get(waitingConnection.address); if (rotater == null) { ChannelRotater newRotater = - new ChannelRotater(waitingConnection.taskId); + new ChannelRotater(waitingConnection.taskId, + waitingConnection.address); rotater = addressChannelMap.putIfAbsent( waitingConnection.address, newRotater); if (rotater == null) {