ONOS-4590 Added back-off mechanism for intent clean-up.

Change-Id: If997943aef8e46caafd21629296b939d6669e374
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCleanup.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCleanup.java
index d51fe3a..68aed97 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCleanup.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCleanup.java
@@ -86,6 +86,7 @@
     private ExecutorService executor;
     private Timer timer;
     private TimerTask timerTask;
+    private int cleanupIteration = 0;
 
     @Activate
     public void activate() {
@@ -188,6 +189,11 @@
     }
 
     private void resubmitPendingRequest(IntentData intentData) {
+        if (cleanupIteration % (intentData.errorCount() + 1) != 0) {
+            // backoff
+            return;
+        }
+
         switch (intentData.request()) {
             case INSTALL_REQ:
                 service.submit(intentData.intent());
@@ -210,6 +216,8 @@
      * re-submit/withdraw appropriately.
      */
     private void cleanup() {
+        cleanupIteration++;
+
         int corruptCount = 0, failedCount = 0, stuckCount = 0, pendingCount = 0;
 
         for (IntentData intentData : store.getIntentData(true, periodMs)) {