diff options
author | Jim Hahn <jrh3@att.com> | 2019-11-06 06:57:50 -0500 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-11-06 09:18:42 -0500 |
commit | 1221c6bcdba722996e74c991881db6e52e158d23 (patch) | |
tree | 791f3343aa90af1e9aee06e0c1a33cf70aca6e16 /feature-drools-init/src/main/java/org | |
parent | 4d7e396e00ef92364e3ea8dd6e35922dc5fae72c (diff) |
Address drools-pdp sonar issues
Addressed more sonar issues in drools-pdp:
- unwrap multiple instances of the same annotation (NamedQuery)
- use lambda instead of anonymous class
- duplicate code; addressed by using annotation instead of toString.
This still leaves other duplicate code.
Issue-ID: POLICY-2203
Change-Id: I8c6ff6562820af638044f134eb8a6725a5f05e8e
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-drools-init/src/main/java/org')
-rw-r--r-- | feature-drools-init/src/main/java/org/onap/policy/drools/droolsinit/DroolsInitFeature.java | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/feature-drools-init/src/main/java/org/onap/policy/drools/droolsinit/DroolsInitFeature.java b/feature-drools-init/src/main/java/org/onap/policy/drools/droolsinit/DroolsInitFeature.java index b3b8485c..f97ed759 100644 --- a/feature-drools-init/src/main/java/org/onap/policy/drools/droolsinit/DroolsInitFeature.java +++ b/feature-drools-init/src/main/java/org/onap/policy/drools/droolsinit/DroolsInitFeature.java @@ -72,16 +72,12 @@ public class DroolsInitFeature implements PolicySessionFeatureApi { final FactHandle factHandle = policySession.getKieSession().insert(this); // after 10 minutes, remove the object from Drools memory (if needed) - PolicyEngineConstants.getManager().getExecutorService().schedule( - new Runnable() { - @Override - public void run() { - if (policySession.getKieSession().getObject(factHandle) != null) { - // object has not been removed by application -- remove it here - policySession.getKieSession().delete(factHandle); - } - } - }, DELAY, TimeUnit.MILLISECONDS); + PolicyEngineConstants.getManager().getExecutorService().schedule(() -> { + if (policySession.getKieSession().getObject(factHandle) != null) { + // object has not been removed by application -- remove it here + policySession.getKieSession().delete(factHandle); + } + }, DELAY, TimeUnit.MILLISECONDS); } } } |