diff options
author | 2018-08-23 17:25:27 +0530 | |
---|---|---|
committer | 2018-08-23 17:25:27 +0530 | |
commit | 962e97959cfe711da4222dcb0e3cb3abebfc3d74 (patch) | |
tree | 4d457254c60f7e5b9d6f07416ca8a050c471a13c /src/main/java/com/att/dmf | |
parent | 03fd7044fb1475673245560f7708ce23fb642930 (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>
Diffstat (limited to 'src/main/java/com/att/dmf')
-rw-r--r-- | src/main/java/com/att/dmf/mr/metrics/publisher/impl/DMaaPCambriaSimplerBatchPublisher.java | 6 |
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; } |