summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumapriya Sarvepalli <ss00493505@techmahindra.com>2018-08-23 17:25:27 +0530
committerSumapriya Sarvepalli <ss00493505@techmahindra.com>2018-08-23 17:25:27 +0530
commit962e97959cfe711da4222dcb0e3cb3abebfc3d74 (patch)
tree4d457254c60f7e5b9d6f07416ca8a050c471a13c
parent03fd7044fb1475673245560f7708ce23fb642930 (diff)
Sonar Major issues
Use isEmpty to check whether the collection is empty or not Sonar Link: https://sonar.onap.org/project/issues?assignees=sumapriya&id=org.onap.dmaap.messagerouter.msgrtr%3Amsgrtr&open=AV4-Vagz32hFUzlqc5s-&resolved=false&severities=MAJOR Location: src/main/java/com/att/dmf/mr/metrics/publisher/impl/DMaaPCambriaSimplerBatchPublisher.java Line No:L189 L254 L276 Change-Id: I272279d7db44611b8339f166dcd5884ead4da1b0 Issue-ID: DMAAP-634 Signed-off-by: Sumapriya Sarvepalli <ss00493505@techmahindra.com>
-rw-r--r--src/main/java/com/att/dmf/mr/metrics/publisher/impl/DMaaPCambriaSimplerBatchPublisher.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/com/att/dmf/mr/metrics/publisher/impl/DMaaPCambriaSimplerBatchPublisher.java b/src/main/java/com/att/dmf/mr/metrics/publisher/impl/DMaaPCambriaSimplerBatchPublisher.java
index d8d8799..5b937c2 100644
--- a/src/main/java/com/att/dmf/mr/metrics/publisher/impl/DMaaPCambriaSimplerBatchPublisher.java
+++ b/src/main/java/com/att/dmf/mr/metrics/publisher/impl/DMaaPCambriaSimplerBatchPublisher.java
@@ -186,7 +186,7 @@ public class DMaaPCambriaSimplerBatchPublisher extends CambriaBaseClient
public void close() {
try {
final List<message> remains = close(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
- if (remains.size() > 0) {
+ if (remains.isEmpty()) {
getLog().warn("Closing publisher with " + remains.size() + " messages unsent. "
+ "Consider using CambriaBatchingPublisher.close( long timeout, TimeUnit timeoutUnits ) to recapture unsent messages on close.");
}
@@ -251,7 +251,7 @@ public class DMaaPCambriaSimplerBatchPublisher extends CambriaBaseClient
*/
private synchronized boolean shouldSendNow() {
boolean shouldSend = false;
- if (fPending.size() > 0) {
+ if (fPending.isEmpty()) {
final long nowMs = Clock.now();
shouldSend = (fPending.size() >= fMaxBatchSize);
@@ -273,7 +273,7 @@ public class DMaaPCambriaSimplerBatchPublisher extends CambriaBaseClient
private synchronized boolean sendBatch() {
// it's possible for this call to be made with an empty list. in this
// case, just return.
- if (fPending.size() < 1) {
+ if (fPending.isEmpty()) {
return true;
}