DESCRIPTION

JCBC-895: Prevent overflow on MAX_VALUE retry

Motivation:
-----------
Retry attempt being set to Integer.MAX_VALUE actually causes an
overflow because the internal retry mechanism adds 1 to the given
attempt limit.

Modifications:
--------------
RetryBuilder and RetryWithDelayHandler both cap the maxAttempt parameter
to Integer.MAX_VALUE - 1 and document this limitation of their input.

Unit tests added to check that the input value of maxAttempts is
decremented by one if it is MAX_VALUE.

Result:
-------
No more "java.lang.IllegalArgumentException: Count can not be negative"
error when the maxAttempts is set to MAX_VALUE.

Change-Id: Ib4cf179fa2b34aa19947ce76e9c85121c669c84a
Reviewed-on: http://review.couchbase.org/58115
Tested-by: Estrella Humphrey xxx@xxx.xxx
Reviewed-by: Cory Peck xxx@xxx.xxx


COMMENTS

author: Tate Garrett
date: 2015-12-24 10:39:08.644000000

Change has been successfully cherry-picked as 16a909a81f182c5d0780428b87f53497676a0ad2

-------------------------------------
