You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/07/20 23:54:20 UTC

[GitHub] [hbase] ndimiduk commented on a change in pull request #2000: HBASE-24658 Update PolicyBasedChaosMonkey to handle uncaught exceptions

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



##########
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:
       It would be nice if we could either get away from using Guava helpers or get away from providing our own. Having both in the code keeps us guessing :)




----------------------------------------------------------------
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:
users@infra.apache.org