diff options
author | rama-huawei <rama.subba.reddy.s@huawei.com> | 2017-09-18 17:57:39 +0530 |
---|---|---|
committer | Rama SubbaReddy <rama.subba.reddy.s@huawei.com> | 2017-09-18 12:31:35 +0000 |
commit | cdfeee0cdb522597b62c080ff018cd2c40c67295 (patch) | |
tree | 63615774b944c7ba4b67a3305fce5e89ec32855c /src/main | |
parent | 3af66448e6107f51ff30acfd440f8331515f1792 (diff) |
Fix for Sonar major issues
DCAEGEN2-93
Change-Id: I0c1d6a75644b8e6f7e8f06dd2e2abcb185a94efb
Signed-off-by: rama-huawei <rama.subba.reddy.s@huawei.com>
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/att/nsa/mr/logging/MRAppender.java | 1 | ||||
-rw-r--r-- | src/main/java/com/att/nsa/mr/test/clients/ConsolePublisher.java | 17 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/main/java/com/att/nsa/mr/logging/MRAppender.java b/src/main/java/com/att/nsa/mr/logging/MRAppender.java index 364f36d..4bb3e71 100644 --- a/src/main/java/com/att/nsa/mr/logging/MRAppender.java +++ b/src/main/java/com/att/nsa/mr/logging/MRAppender.java @@ -106,6 +106,7 @@ public class MRAppender extends AppenderSkeleton { } } + @Override public void activateOptions() { if (hosts != null && topic != null && partition != null) { fPublisher = MRClientFactory.createBatchingPublisher(hosts.split(","), topic, maxBatchSize, maxAgeMs, compress); diff --git a/src/main/java/com/att/nsa/mr/test/clients/ConsolePublisher.java b/src/main/java/com/att/nsa/mr/test/clients/ConsolePublisher.java index 2294d7b..61aa836 100644 --- a/src/main/java/com/att/nsa/mr/test/clients/ConsolePublisher.java +++ b/src/main/java/com/att/nsa/mr/test/clients/ConsolePublisher.java @@ -29,6 +29,9 @@ import java.util.List; import java.util.UUID; import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.att.nsa.mr.client.MRBatchingPublisher; import com.att.nsa.mr.client.MRClientFactory; import com.att.nsa.mr.client.MRPublisher.message; @@ -39,16 +42,20 @@ import com.att.nsa.mr.client.MRPublisher.message; */ public class ConsolePublisher { + + private static final Logger logger = LoggerFactory.getLogger(ConsolePublisher.class); + private ConsolePublisher() { + } public static void main ( String[] args ) throws IOException //throws IOException, InterruptedException { // read the hosts(s) from the command line - final String hosts = ( args.length > 0 ? args[0] : "aaa.it.att.com,bbb.it.att.com,ccc.it.att.com" ); + final String hosts = args.length > 0 ? args[0] : "aaa.it.att.com,bbb.it.att.com,ccc.it.att.com"; // read the topic name from the command line - final String topic = ( args.length > 1 ? args[1] : "TEST-TOPIC" ); + final String topic = args.length > 1 ? args[1] : "TEST-TOPIC"; // read the topic name from the command line - final String partition = ( args.length > 2 ? args[2] : UUID.randomUUID ().toString () ); + final String partition = args.length > 2 ? args[2] : UUID.randomUUID ().toString (); // set up some batch limits and the compression flag final int maxBatchSize = 100; @@ -76,11 +83,11 @@ public class ConsolePublisher } catch ( InterruptedException e ) { - System.err.println ( "Send on close interrupted." ); + logger.error( "Send on close interrupted." ); } for ( message m : leftovers ) { - System.err.println ( "Unsent message: " + m.fMsg ); + logger.error( "Unsent message: " + m.fMsg ); } } } |