Github user duchuyctlk commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/491#discussion_r108191512
  
    --- Diff: 
metron-interface/metron-rest/src/test/java/org/apache/metron/rest/controller/KafkaControllerIntegrationTest.java
 ---
    @@ -54,135 +58,165 @@
     @ActiveProfiles(TEST_PROFILE)
     public class KafkaControllerIntegrationTest {
     
    -    @Autowired
    -    private KafkaComponent kafkaWithZKComponent;
    -
    -    class SampleDataRunner implements Runnable {
    -
    -        private boolean stop = false;
    -        private String path = 
"../../metron-platform/metron-integration-test/src/main/sample/data/bro/raw/BroExampleOutput";
    -
    -        @Override
    -        public void run() {
    -            SampleDataGenerator broSampleDataGenerator = new 
SampleDataGenerator();
    -            
broSampleDataGenerator.setBrokerUrl(kafkaWithZKComponent.getBrokerList());
    -            broSampleDataGenerator.setNum(1);
    -            broSampleDataGenerator.setSelectedSensorType("bro");
    -            broSampleDataGenerator.setDelay(0);
    -            try {
    -                while(!stop) {
    -                    broSampleDataGenerator.generateSampleData(path);
    -                }
    -            } catch (IOException e) {
    -                e.printStackTrace();
    -            } catch (ParseException e) {
    -                e.printStackTrace();
    -            }
    -        }
    -
    -        public void stop() {
    -            stop = true;
    +  private static final int KAFKA_RETRY = 10;
    +  @Autowired
    +  private KafkaComponent kafkaWithZKComponent;
    +
    +  class SampleDataRunner implements Runnable {
    +
    +    private boolean stop = false;
    +    private String path = 
"../../metron-platform/metron-integration-test/src/main/sample/data/bro/raw/BroExampleOutput";
    +
    +    @Override
    +    public void run() {
    +      SampleDataGenerator broSampleDataGenerator = new 
SampleDataGenerator();
    +      
broSampleDataGenerator.setBrokerUrl(kafkaWithZKComponent.getBrokerList());
    +      broSampleDataGenerator.setNum(1);
    +      broSampleDataGenerator.setSelectedSensorType("bro");
    +      broSampleDataGenerator.setDelay(0);
    +      try {
    +        while(!stop) {
    +          broSampleDataGenerator.generateSampleData(path);
             }
    +      } catch (IOException e) {
    --- End diff --
    
    Because you handle both `Exception`s in a same way, I think you could apply 
[Multiple 
catching](http://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.html)
 which is available from Java 7


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to