apache/incubator-storm — pull request #220 by kishorvpatil (2014-08-08 20:44:51+00:00)
Title: [STORM-330] Implement storm exponential backoff stategy for netty client and curator

Fix [netty Client.java](storm-core/src/jvm/backtype/storm/messaging/netty/Client.java) retry logic and [Utils.java](storm-core/src/jvm/backtype/storm/utils/Utils.java
) Curator Framework.
The `StormBoundedExponentialBackoffRetry` provides generic exponential-linear backoff retry policy for STORM. It overcomes the following shortcomings in curator frameworks implementation of `BoundedExponentialBackOffRetry`:
- Limitation maxRetries to 29.
- `getSleepTimeMs` fails with IllegalArgumentException by passing -ve argument to random.nextInt if retryCount > 29.
- Also, exponential calculation in quickly catches up to `maxSleepTimeMs` - eventually adding more delay and increasing collision possibility.
This class calculates `threshold` for exponentially increasing `sleeptime` for retries. Beyond threshold, the sleep time increase is linear.
It adds jitter for exponential/linear retry.
It guarantees `currSleepTimeMs >= prevSleepTimeMs` and `baseSleepTimeMs <= currSleepTimeMs <= maxSleepTimeMs`