Guest User

Untitled

a guest
Jun 17th, 2016
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. // 1. works fine
  2.  
  3. String topic = "test-topic";
  4.  
  5. for (int i = 0; i <= 50; i++) {
  6.     String t = topic + "-" + i;
  7.     AdminUtils.createTopic(zkUtils, t, partitions, replication, defaultProperties, defaultRackAwareMode);
  8. }
  9.  
  10. for (int i = 0; i <= 50; i++) {
  11.     String t = topic + "-" + i;
  12.  
  13.     Run run = new Run(t, consumerProps); // starts a KafkaConsumer
  14.     dispatcher.submit(run);
  15. }
  16.  
  17. // vs
  18.  
  19. // 2. fails sometimes
  20.  
  21. for (int i = 50; i <= 100; i++) {
  22.     String t = topic + "-" + i;
  23.  
  24.     AdminUtils.createTopic(zkUtils, t, partitions, replication, defaultProperties, defaultRackAwareMode);
  25.  
  26.     Run run = new Run(t, consumerProps); // starts a KafkaConsumer
  27.     dispatcher.submit(run);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment