summaryrefslogtreecommitdiffstats
path: root/feature-session-persistence/src/main/java/org/onap
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2017-09-14 13:49:52 -0400
committerPamela Dragosh <pdragosh@research.att.com>2017-09-15 09:51:44 -0400
commitefdb9a5148dfda3c0c0275134da42d96674490fb (patch)
treeebb18b3a3249b6e6f45ecd7f8697e124ead3e75f /feature-session-persistence/src/main/java/org/onap
parent7ca599cb444c3896beb9318c90a460adb1f276b9 (diff)
Fix sonar related to persistence-feature
Sonar blocker for catchable: I am not sure why this is wrapped with an exception. Changing try-catch to use Exception | LinkageError per Jorge/Ralph. Sonar critical for logging exceptions. Sonar critical for casting to Long and reinterrupting thread. Change-Id: I44d46f005d9aa30c434c22e479034107055277ce Issue-ID: POLICY-195 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'feature-session-persistence/src/main/java/org/onap')
-rw-r--r--feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
index e6603b68..b48690b0 100644
--- a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
+++ b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
@@ -732,7 +732,7 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
* before firing rules again. This is a "half" time, so that
* we can multiply it by two without overflowing the word size.
*/
- long halfMaxSleepTime = 5000 / 2;
+ long halfMaxSleepTime = 5000L / 2L;
/**
* Constructor - initialize variables and create thread
@@ -819,6 +819,7 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
} catch (InterruptedException e) {
logger.error("stopThread exception: ", e);
+ Thread.currentThread().interrupt();
}
// verify that it's done
@@ -866,11 +867,9 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
// no rules fired -- increase poll delay
sleepTime = 2 * Math.min(halfMaxSleepTime, sleepTime);
}
-
- } catch (Throwable e) {
- logger.error("startThread exception: ", e);
- }
-
+ } catch (Exception | LinkageError e) {
+ logger.error("Exception during kieSession.fireAllRules", e);
+ }
try {
if(stopped.await(sleepTime, TimeUnit.MILLISECONDS)) {
@@ -879,6 +878,7 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
} catch (InterruptedException e) {
logger.error("startThread exception: ", e);
+ Thread.currentThread().interrupt();
break;
}
}