aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorrama-huawei <rama.subba.reddy.s@huawei.com>2017-09-18 17:00:39 +0530
committerRama SubbaReddy <rama.subba.reddy.s@huawei.com>2017-09-18 12:31:26 +0000
commit3af66448e6107f51ff30acfd440f8331515f1792 (patch)
tree9c8c38ca8470f2d7b668e8a8878941e5a74f18df /src
parentd87c09894ad714e711ea2e10844262182d226fa3 (diff)
Fix for Sonar major issues
DCAEGEN2-93 Change-Id: I5f06f8086f2c64ae2b8cdeca68900839b5c73fa3 Signed-off-by: rama-huawei <rama.subba.reddy.s@huawei.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java b/src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java
index bc54a01..bdd15d4 100644
--- a/src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java
+++ b/src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java
@@ -32,14 +32,20 @@ import javax.ws.rs.core.MultivaluedMap;
import com.att.nsa.mr.client.MRClientFactory;
import com.att.nsa.mr.client.MRConsumer;
+import java.util.List;
+
public class SimpleExampleConsumer {
private static final Logger logger = LoggerFactory.getLogger(SimpleExampleConsumer.class);
+ private SimpleExampleConsumer() {
+ }
+
public static void main(String[] args) {
long count = 0;
long nextReport = 5000;
+ String key;
final long startMs = System.currentTimeMillis();
@@ -48,22 +54,23 @@ public class SimpleExampleConsumer {
final MRConsumer cc = MRClientFactory.createConsumer("D:\\SG\\consumer.properties");
while (true) {
for (String msg : cc.fetch()) {
-
- System.out.println("Message Received: " + msg);
+ logger.debug("Message Received: " + msg);
}
// Header for DME2 Call.
MultivaluedMap<String, Object> headersMap = MRClientFactory.HTTPHeadersMap;
- for (String key : headersMap.keySet()) {
- System.out.println("Header Key " + key);
- System.out.println("Header Value " + headersMap.get(key));
+ for (MultivaluedMap.Entry<String,List<Object>> entry: headersMap.entrySet()) {
+ key = entry.getKey();
+ logger.debug("Header Key " + key);
+ logger.debug("Header Value " + headersMap.get(key));
}
// Header for HTTP Call.
- Map<String, String>
- dme2headersMap=MRClientFactory.DME2HeadersMap; for(String key
- : dme2headersMap.keySet()) { System.out.println("Header Key "
- + key); System.out.println("Header Value " +
- dme2headersMap.get(key)); }
+ Map<String, String> dme2headersMap=MRClientFactory.DME2HeadersMap;
+ for(Map.Entry<String,String> entry: dme2headersMap.entrySet()) {
+ key = entry.getKey();
+ logger.debug("Header Key " + key);
+ logger.debug("Header Value " + dme2headersMap.get(key));
+ }
if (count > nextReport) {
nextReport += 5000;
@@ -72,12 +79,11 @@ public class SimpleExampleConsumer {
final long elapsedMs = endMs - startMs;
final double elapsedSec = elapsedMs / 1000.0;
final double eps = count / elapsedSec;
- System.out.println("Consumed " + count + " in " + elapsedSec + "; " + eps + " eps");
+ logger.error("Consumed " + count + " in " + elapsedSec + "; " + eps + " eps");
}
}
} catch (Exception x) {
- System.err.println(x.getClass().getName() + ": " + x.getMessage());
- logger.error("exception: ", x);
+ logger.error(x.getClass().getName() + ": " + x.getMessage());
}
}
}