You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by pt...@apache.org on 2014/03/05 20:28:33 UTC

git commit: Fixing an integer overflow in getSleepTimeMs(). This should fix the issue of negative values passed to sleep, causing IllegalArgumentExceptions.

Repository: incubator-storm
Updated Branches:
  refs/heads/master 254ec135b -> d9d637eab


Fixing an integer overflow in getSleepTimeMs().  This should fix the
issue of negative values passed to sleep, causing
IllegalArgumentExceptions.

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

Branch: refs/heads/master
Commit: d9d637eab5f3761a4768fc960b2574d45962b466
Parents: 254ec13
Author: Drew <dr...@gradientx.com>
Authored: Mon Mar 3 12:08:43 2014 -0800
Committer: Drew <dr...@gradientx.com>
Committed: Mon Mar 3 12:08:43 2014 -0800

----------------------------------------------------------------------
 .../src/jvm/backtype/storm/messaging/netty/Client.java       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/d9d637ea/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java b/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java
index d765e71..0e62302 100644
--- a/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java
+++ b/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java
@@ -40,8 +40,8 @@ import java.util.concurrent.atomic.AtomicReference;
 class Client implements IConnection {
     private static final Logger LOG = LoggerFactory.getLogger(Client.class);
     private final int max_retries;
-    private final int base_sleep_ms;
-    private final int max_sleep_ms;
+    private final long base_sleep_ms;
+    private final long max_sleep_ms;
     private LinkedBlockingQueue<Object> message_queue; //entry should either be TaskMessage or ControlMessage
     private AtomicReference<Channel> channelRef;
     private final ClientBootstrap bootstrap;
@@ -107,10 +107,10 @@ class Client implements IConnection {
     /**
      * # of milliseconds to wait per exponential back-off policy
      */
-    private int getSleepTimeMs()
+    private long getSleepTimeMs()
     {
         int backoff = 1 << retries.get();
-        int sleepMs = base_sleep_ms * Math.max(1, random.nextInt(backoff));
+        long sleepMs = base_sleep_ms * Math.max(1, random.nextInt(backoff));
         if ( sleepMs > max_sleep_ms )
             sleepMs = max_sleep_ms;
         return sleepMs;