DESCRIPTION

JCBC-875: retrybuilder advanced error predicate + doOnRetry

Motivation:
-----------
When using the RetryBuilder, one can have an even more complex check to
perform on the exception do determine if it should be retried or not.
Currently the only possible check is on the exception type, but not its
content (eg. message, or special fields in the exception).

Similarly, sometimes one wants to perform a side-effect action when the
retry occurs, and this is not possible in the current implementation.

Modification:
-------------
Added two features to the RetryBuilder:

 * one can construct the builder based on a Func1<Throwable, Boolean>
   predicate, that will allow to tell if the error should trigger a
   retry, allowing inspection of the whole error.
 * added a doOnRetry() method that gets notified every time a retry is
   scheduled with: the retry attempt number, the exception triggering
   the retry, the scheduled delay (duration and unit) after which the
   retry will occur.

The signature for the doOnRetry, a specialized Func4, can be simplified
using the RetryBuilder.OnRetryAction interface.

Results:
--------
RetryBuilder gives even more control on when to retry, and allows you to
add side-effects to each retry attempt.

Change-Id: Idecf6403a5bfa5896a682422a2636c10d0fa3e2d


COMMENTS

author: Estrella Humphrey
date: 2016-03-04 13:27:58.215000000

Patch Set 2: Verified+1

-------------------------------------
author: Natasha Sullivan
date: 2016-03-18 12:31:33.744000000

Patch Set 2: Code-Review+2

-------------------------------------
author: Tate Garrett
date: 2016-03-18 14:00:32.233000000

Change has been successfully cherry-picked as 62aadf9ad755632151f2451b0002c020b380ccc0

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