virajjasani commented on a change in pull request #2000:
URL: https://github.com/apache/hbase/pull/2000#discussion_r452815115



##########
File path: 
hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/monkies/PolicyBasedChaosMonkey.java
##########
@@ -38,14 +42,16 @@
 
   private static final Logger LOG = 
LoggerFactory.getLogger(PolicyBasedChaosMonkey.class);

Review comment:
       nit: redundant

##########
File path: 
hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/monkies/PolicyBasedChaosMonkey.java
##########
@@ -60,19 +66,30 @@ public PolicyBasedChaosMonkey(IntegrationTestingUtility 
util, Collection<Policy>
   }
 
   public PolicyBasedChaosMonkey(Properties monkeyProps, 
IntegrationTestingUtility util,
-    Policy... policies) {
-    this.monkeyProps = monkeyProps;
-    this.util = util;
-    this.policies = policies;
+    Collection<Policy> policies) {
+    this(monkeyProps, util, policies.toArray(new Policy[0]));
   }
 
   public PolicyBasedChaosMonkey(Properties monkeyProps, 
IntegrationTestingUtility util,
-    Collection<Policy> policies) {
+    Policy... policies) {
     this.monkeyProps = monkeyProps;
-    this.util = util;
-    this.policies = policies.toArray(new Policy[policies.size()]);
+    this.util = Objects.requireNonNull(util);
+    this.policies = Objects.requireNonNull(policies);
+    if (policies.length == 0) {
+      throw new IllegalArgumentException("policies may not be empty");
+    }
+    this.monkeyThreadPool = buildMonkeyThreadPool(policies.length);
   }
 
+  private static ExecutorService buildMonkeyThreadPool(final int size) {
+    return Executors.newFixedThreadPool(size, new ThreadFactoryBuilder()

Review comment:
       Would you prefer using our internal 
   `Threads.newDaemonThreadFactory(String prefix, UncaughtExceptionHandler 
handler)` ?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to