[NO ISSUE][MISC] IRetryPolicy requires non-null throwable

Change-Id: I4835266435fc31f5973f4312e6ddcbdb85d1e839
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/6923
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/RecoveryTask.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/RecoveryTask.java
index a1989fc..c7951475 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/RecoveryTask.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/RecoveryTask.java
@@ -106,8 +106,8 @@
 
     protected Void doRecover(IRetryPolicy policy) throws AlgebricksException, InterruptedException {
         LOGGER.log(level, "Actual Recovery task has started");
-        Exception failure = null;
-        while (policy.retry(failure)) {
+        Exception failure;
+        do {
             synchronized (listener) {
                 while (!cancelRecovery && clusterStateManager.getState() != ClusterState.ACTIVE) {
                     listener.wait();
@@ -139,7 +139,7 @@
             } finally {
                 releaseRecoveryLocks(metadataProvider);
             }
-        }
+        } while (policy.retry(failure));
         // Recovery task is essntially over now either through failure or through cancellation(stop)
         synchronized (listener) {
             listener.notifyAll();
diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/IRetryPolicy.java b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/IRetryPolicy.java
index 29469d5..0d18a2b 100644
--- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/IRetryPolicy.java
+++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/IRetryPolicy.java
@@ -22,7 +22,7 @@
 public interface IRetryPolicy {
     /**
      * @param failure
-     *            the cause of the failure
+     *            the cause of the failure (this cannot be null)
      * @return true if one more attempt should be done
      */
     boolean retry(Throwable failure);