summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-03-27 11:12:11 -0400
committerPamela Dragosh <pdragosh@research.att.com>2020-03-27 11:12:16 -0400
commit8b10bae2761fd7891044e9c758e712b2b54bd8ba (patch)
tree492b2adaf6633a327adf2a8e28e06654a544ffcc /plugins
parent438b24fcd54e25719583d16f689e03d1bcfee2a8 (diff)
Use AtomicInteger and other sonar
Removed unused logger. Added NOSONAR to main to remove security risk, as we do validate arguments. Used AtomicInteger. Issue-ID: POLICY-2305 Change-Id: I18e91836e914b7fd6e3cd9a950dca58fcd8be5b5 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandler.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandler.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandler.java
index b89a679b..5d011f0c 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandler.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandler.java
@@ -27,7 +27,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-
+import java.util.concurrent.atomic.AtomicInteger;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.model.Csar;
import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
@@ -60,7 +60,7 @@ public class SdcReceptionHandler extends AbstractReceptionHandler implements INo
private SdcReceptionHandlerStatus sdcReceptionHandlerStatus = SdcReceptionHandlerStatus.STOPPED;
private IDistributionClient distributionClient;
private SdcConfiguration sdcConfig;
- private volatile int nbOfNotificationsOngoing = 0;
+ private AtomicInteger nbOfNotificationsOngoing = new AtomicInteger();
private int retryDelay;
private SdcClientHandler sdcClientHandler;
@@ -109,7 +109,7 @@ public class SdcReceptionHandler extends AbstractReceptionHandler implements INo
handleIdleStatusChange(newStatus);
break;
case BUSY:
- ++nbOfNotificationsOngoing;
+ nbOfNotificationsOngoing.incrementAndGet();
sdcReceptionHandlerStatus = newStatus;
break;
default:
@@ -370,10 +370,10 @@ public class SdcReceptionHandler extends AbstractReceptionHandler implements INo
* @param newStatus the new status
*/
private void handleIdleStatusChange(final SdcReceptionHandlerStatus newStatus) {
- if (nbOfNotificationsOngoing > 1) {
- --nbOfNotificationsOngoing;
+ if (nbOfNotificationsOngoing.get() > 1) {
+ nbOfNotificationsOngoing.decrementAndGet();
} else {
- nbOfNotificationsOngoing = 0;
+ nbOfNotificationsOngoing.set(0);
sdcReceptionHandlerStatus = newStatus;
}
}