Closed mattinger closed 10 years ago
So - Looking over this patch - I see two things, 1) You included Spring Batch, but I don't think I see any use of that new dep. in the code you have in the patch. 2) At least on of the files in the patch has a * import. Can you point out what the addition of spring batch dependance? Did I just miss where that is being used?
It's actually extending the spring batch's "RetryTemplate" class.
public class ExtendedRetryTemplate extends RetryTemplate
The purpose of this patch is to extend their RetryTemplate to support Runnable and Callable (which they don't support currently, and you have to implement their "RetryCallback" interface).
The built in RetryPolicy that comes with spring batch only allows an exact class match to be used for determining which exceptions trigger a retry and which don't. I have built another implementation which is based on spring's "Classifier" interface, and an implementation of "Classifier" which is based on a Predicate function. This allows the caller to make a much more dynamic decision on whether to retry. For example, they could look at the error message, sql state codes, or anything else related to the exception which was thrown.
And finally, i added some useful predicates for that, such as checking whether the given exception contains a particular string in it's message (something we kind of have to do cep, which i don't like, but it's really the only good way due to the merlin api design). I'm willing to forgo the ExtendedPredicates class if you don't find it useful for jrugged. As well as the PredicateBinaryExceptionClassifier, which is mostly a convenience for using google's Predicate interface.
In particular, this adds the following capability: