aboutsummaryrefslogtreecommitdiffstats
path: root/integrity-audit
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-04-06 19:12:11 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-06 19:12:11 +0000
commit825dba80268f932ab1fcb2f4ab310020a91ce050 (patch)
tree055a9345c21b5fbe8ef22636ca66ca1d86be6569 /integrity-audit
parent9f9131575d2e2b1002a3e108f7793a97fa7652ab (diff)
parent82ac8775dfa540fa856ecfd284c69afa44790dd8 (diff)
Merge "More sonar issues in common"
Diffstat (limited to 'integrity-audit')
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java
index 25335540..accef643 100644
--- a/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java
+++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java
@@ -169,7 +169,9 @@ public class AuditThread extends Thread {
IntegrityAuditEntity thisEntity;
integrityAudit.setThreadInitialized(true); // An exception will set it to false
- while (true) {
+ boolean interrupted = false;
+
+ while (!interrupted) {
try {
/*
* It may have been awhile since we last cycled through this loop, so refresh
@@ -208,16 +210,16 @@ public class AuditThread extends Thread {
if (isInterruptedException(e)) {
String msg = "AuditThread.run loop - Exception thrown: " + e.getMessage() + "; Stopping.";
logger.error(MessageCodes.EXCEPTION_ERROR, e, msg);
- break;
- }
+ interrupted = true;
- String msg = "AuditThread.run loop - Exception thrown: " + e.getMessage()
- + "; Will try audit again in " + integrityAuditPeriodSeconds + " seconds";
- logger.error(MessageCodes.EXCEPTION_ERROR, e, msg);
- // Sleep and try again later
- AuditorTime.getInstance().sleep(integrityAuditPeriodSeconds * 1000L);
+ } else {
+ String msg = "AuditThread.run loop - Exception thrown: " + e.getMessage()
+ + "; Will try audit again in " + integrityAuditPeriodSeconds + " seconds";
+ logger.error(MessageCodes.EXCEPTION_ERROR, e, msg);
+ // Sleep and try again later
+ AuditorTime.getInstance().sleep(integrityAuditPeriodSeconds * 1000L);
+ }
}
-
}
}