Abstracted the Retry Policy logic to allow for custom policies.

As per the discussion on the mailing list this patch is an attempt to abstract retry policies so users can create custom logic to retry a query.