hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r1692342 - in /hama/trunk: CHANGES.txt core/src/main/java/org/apache/hama/bsp/message/HamaAsyncMessageManagerImpl.java
Date Thu, 23 Jul 2015 02:13:00 GMT
Author: edwardyoon
Date: Thu Jul 23 02:12:59 2015
New Revision: 1692342

URL: http://svn.apache.org/r1692342
Log:
HAMA-965: Infinite loop because of recursive function call

Modified:
    hama/trunk/CHANGES.txt
    hama/trunk/core/src/main/java/org/apache/hama/bsp/message/HamaAsyncMessageManagerImpl.java

Modified: hama/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hama/trunk/CHANGES.txt?rev=1692342&r1=1692341&r2=1692342&view=diff
==============================================================================
--- hama/trunk/CHANGES.txt (original)
+++ hama/trunk/CHANGES.txt Thu Jul 23 02:12:59 2015
@@ -1,6 +1,17 @@
 Hama Change Log
 
-Release 0.7.0 (unreleased changes)
+Release 0.7.1 (unreleased changes)
+
+  NEW FEATURES
+
+  BUG FIXES
+
+    HAMA-965: Infinite loop because of recursive function call (JongYoon Lim via edwardyoon)
+
+  IMPROVEMENTS
+
+
+Release 0.7.0 - Jun 14, 2015
 
   NEW FEATURES
 

Modified: hama/trunk/core/src/main/java/org/apache/hama/bsp/message/HamaAsyncMessageManagerImpl.java
URL: http://svn.apache.org/viewvc/hama/trunk/core/src/main/java/org/apache/hama/bsp/message/HamaAsyncMessageManagerImpl.java?rev=1692342&r1=1692341&r2=1692342&view=diff
==============================================================================
--- hama/trunk/core/src/main/java/org/apache/hama/bsp/message/HamaAsyncMessageManagerImpl.java
(original)
+++ hama/trunk/core/src/main/java/org/apache/hama/bsp/message/HamaAsyncMessageManagerImpl.java
Thu Jul 23 02:12:59 2015
@@ -51,15 +51,20 @@ public final class HamaAsyncMessageManag
   private static final Log LOG = LogFactory
       .getLog(HamaAsyncMessageManagerImpl.class);
 
+  private static final int MAX_RETRY = 5;
+
   private AsyncServer server;
 
   private LRUCache<InetSocketAddress, HamaMessageManager<M>> peersLRUCache =
null;
 
+  private static int retry = 0;
+
   @SuppressWarnings("serial")
   @Override
   public final void init(TaskAttemptID attemptId, BSPPeer<?, ?, ?, ?, M> peer,
       HamaConfiguration conf, InetSocketAddress peerAddress) {
     super.init(attemptId, peer, conf, peerAddress);
+    retry = 0;
     startRPCServer(conf, peerAddress);
     peersLRUCache = new LRUCache<InetSocketAddress, HamaMessageManager<M>>(
         maxCachedConnections) {
@@ -87,7 +92,6 @@ public final class HamaAsyncMessageManag
   }
 
   private void startServer(String hostName, int port) throws IOException {
-    int retry = 0;
     try {
       this.server = AsyncRPC.getServer(this, hostName, port,
           conf.getInt("hama.default.messenger.handler.threads.num", 5), false,
@@ -98,12 +102,10 @@ public final class HamaAsyncMessageManag
           + " port:" + server.getAddress().getPort());
     } catch (BindException e) {
       LOG.warn("Address already in use. Retrying " + hostName + ":" + port + 1);
-      startServer(hostName, port + 1);
-      retry++;
-
-      if (retry > 5) {
+      if (retry++ >= MAX_RETRY) {
         throw new RuntimeException("RPC Server could not be launched!");
       }
+      startServer(hostName, port + 1);
     }
   }
 



Mime
View raw message