icegem-core/src/main/java/com/googlecode/icegem/utils/CacheUtils.java
public static <T> T retryWithExponentialBackoff(Retryable<T> runnable,
			int maxRetries) throws InterruptedException,
			OperationRetryFailedException {
		int retry = 0;

		while (retry < maxRetries) {
			retry++;

			try {
				return runnable.execute();
			} catch (OperationRequireRetryException e) {
				// No-op.
			} catch (InterruptedException e) {
				throw e;
			}

			if (retry > 1) {
				long delay = (long) ((BACKOFF_BASE << retry) * Math.random());

				log.debug("Operation requested retry. Sleep for {} millis",
						delay);

				Thread.sleep(delay);
			}
		}

		throw new OperationRetryFailedException(
				"Maximum number of operation retries reached");
	}
public static <T> T retryWithExponentialBackoff(Retryable<T> runnable,
			int maxRetries) throws InterruptedException,
			OperationRetryFailedException {
		int retry = 0;

		while (retry < maxRetries) {
			retry++;

			try {
				return runnable.execute();
			} catch (OperationRequireRetryException e) {
				// No-op.
			} catch (InterruptedException e) {
				throw e;
			}

			if (retry > 1) {
				long delay = (long) ((BACKOFF_BASE << retry) * Math.random());

				log.debug("Operation requested retry. Sleep for {} millis",
						delay);

				Thread.sleep(delay);
			}
		}

		throw new OperationRetryFailedException(
				"Maximum number of operation retries reached");
	}
Retries passed operation with random exponential back off delay.

@param <T>
Type of returned value.
@param runnable
the operation.
@param maxRetries
the maximum number of retries.
@return the value returned by operation
@throws OperationRetryFailedException
@throws InterruptedException