Fix the Sonar Findings
[holmes/engine-management.git] / engine-d / src / main / java / org / onap / holmes / engine / dmaap / DMaaPAlarmPolling.java
index 141d89e..935d2c8 100644 (file)
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 package org.onap.holmes.engine.dmaap;
-
 import java.util.ArrayList;
 import java.util.List;
 import lombok.extern.slf4j.Slf4j;
@@ -42,9 +41,21 @@ public class DMaaPAlarmPolling implements Runnable {
                 vesAlarmList = subscriber.subscribe();
                 vesAlarmList.forEach(vesAlarm -> droolsEngine.putRaisedIntoStream(vesAlarm));
             } catch (CorrelationException e) {
-                log.error("Failed to process alarms.", e);
+                log.error("Failed to process alarms. Sleep for 60 seconds to restart.", e);
+                try {
+                    Thread.sleep(60000);
+                } catch (InterruptedException e1) {
+                    log.info("Thread is still active.", e);
+                    Thread.currentThread().interrupt();
+                }
             } catch (Exception e) {
-                log.error("An error occurred while processing alarm.", e);
+                log.error("An error occurred while processing alarm. Sleep for 60 seconds to restart.", e);
+                try {
+                    Thread.sleep(60000);
+                } catch (InterruptedException e1) {
+                    log.info("Thread is still active.", e);
+                    Thread.currentThread().interrupt();
+                }
             }
         }
     }