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/08/20 11:53:58 UTC

[GitHub] [hbase] ddupg opened a new pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

ddupg opened a new pull request #2286:
URL: https://github.com/apache/hbase/pull/2286


   


----------------------------------------------------------------
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



[GitHub] [hbase] saintstack commented on pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

Posted by GitBox <gi...@apache.org>.
saintstack commented on pull request #2286:
URL: https://github.com/apache/hbase/pull/2286#issuecomment-677927003


   Oh, want to say why you are making these changes? You having port clashes running tests?  What is the difference in test time after these changes?


----------------------------------------------------------------
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



[GitHub] [hbase] ddupg commented on a change in pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

Posted by GitBox <gi...@apache.org>.
ddupg commented on a change in pull request #2286:
URL: https://github.com/apache/hbase/pull/2286#discussion_r475192320



##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/TestJMXConnectorServer.java
##########
@@ -56,39 +58,47 @@
   private static Configuration conf = null;
   private static Admin admin;
   // RMI registry port
-  private static int rmiRegistryPort = 61120;
+  private static int rmiRegistryPort;
   // Switch for customized Accesscontroller to throw ACD exception while executing test case
-  static boolean hasAccess;
+  private volatile static boolean hasAccess;
 
-  @Before
-  public void setUp() throws Exception {
-    UTIL = new HBaseTestingUtility();
+  @BeforeClass
+  public static void setUpBeforeClass() throws Exception {
     conf = UTIL.getConfiguration();
+    String cps = JMXListener.class.getName() + "," + MyAccessController.class.getName();
+    conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, cps);
+    conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY, cps);
+    rmiRegistryPort = UTIL.randomFreePort();
+    conf.setInt("master.rmi.registry.port", rmiRegistryPort);
+    conf.setInt("regionserver.rmi.registry.port", rmiRegistryPort);
+    UTIL.startMiniCluster();
+    admin = UTIL.getConnection().getAdmin();
   }
 
-  @After
-  public void tearDown() throws Exception {
-    // Set to true while stopping cluster
-    hasAccess = true;
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
     admin.close();
     UTIL.shutdownMiniCluster();
   }
 
+  @Before
+  public void setUp() {
+    hasAccess = false;

Review comment:
       [HMaster#stopMaster](https://github.com/apache/hbase/blob/9f62a82334574b135f8e220b024981df64fab811/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java#L2944) doesn't catch any exception that `cpHost.preStopMaster()` throws out. 
   [HRegionServer#stop](https://github.com/apache/hbase/blob/9f62a82334574b135f8e220b024981df64fab811/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java#L2255) catches exception from `rsHost.preStop`.
   But I have no idea why the two are different in the design of handling exceptions.




----------------------------------------------------------------
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



[GitHub] [hbase] infraio merged pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

Posted by GitBox <gi...@apache.org>.
infraio merged pull request #2286:
URL: https://github.com/apache/hbase/pull/2286


   


----------------------------------------------------------------
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



[GitHub] [hbase] Apache-HBase commented on pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on pull request #2286:
URL: https://github.com/apache/hbase/pull/2286#issuecomment-677639502


   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |:----:|----------:|--------:|:--------|
   | +0 :ok: |  reexec  |   0m 31s |  Docker mode activated.  |
   ||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  No case conflicting files found.  |
   | +1 :green_heart: |  hbaseanti  |   0m  0s |  Patch does not have any anti-patterns.  |
   | +1 :green_heart: |  @author  |   0m  0s |  The patch does not contain any @author tags.  |
   ||| _ master Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   4m 10s |  master passed  |
   | +1 :green_heart: |  checkstyle  |   1m 11s |  master passed  |
   | +1 :green_heart: |  spotbugs  |   2m 20s |  master passed  |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   3m 45s |  the patch passed  |
   | +1 :green_heart: |  checkstyle  |   1m 18s |  hbase-server: The patch generated 0 new + 0 unchanged - 1 fixed = 0 total (was 1)  |
   | +1 :green_heart: |  whitespace  |   0m  0s |  The patch has no whitespace issues.  |
   | +1 :green_heart: |  hadoopcheck  |  13m 34s |  Patch does not cause any errors with Hadoop 3.1.2 3.2.1.  |
   | +1 :green_heart: |  spotbugs  |   2m 25s |  the patch passed  |
   ||| _ Other Tests _ |
   | +1 :green_heart: |  asflicense  |   0m 15s |  The patch does not generate ASF License warnings.  |
   |  |   |  37m 41s |   |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | Client=19.03.12 Server=19.03.12 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/artifact/yetus-general-check/output/Dockerfile |
   | GITHUB PR | https://github.com/apache/hbase/pull/2286 |
   | Optional Tests | dupname asflicense spotbugs hadoopcheck hbaseanti checkstyle |
   | uname | Linux 4da0bd5cd332 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/hbase-personality.sh |
   | git revision | master / 1164531d5a |
   | Max. process+thread count | 94 (vs. ulimit of 12500) |
   | modules | C: hbase-server U: hbase-server |
   | Console output | https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/console |
   | versions | git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f) spotbugs=3.1.12 |
   | Powered by | Apache Yetus 0.11.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


----------------------------------------------------------------
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



[GitHub] [hbase] saintstack commented on a change in pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

Posted by GitBox <gi...@apache.org>.
saintstack commented on a change in pull request #2286:
URL: https://github.com/apache/hbase/pull/2286#discussion_r474293872



##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/TestJMXConnectorServer.java
##########
@@ -56,39 +58,47 @@
   private static Configuration conf = null;
   private static Admin admin;
   // RMI registry port
-  private static int rmiRegistryPort = 61120;
+  private static int rmiRegistryPort;
   // Switch for customized Accesscontroller to throw ACD exception while executing test case
-  static boolean hasAccess;
+  private volatile static boolean hasAccess;
 
-  @Before
-  public void setUp() throws Exception {
-    UTIL = new HBaseTestingUtility();
+  @BeforeClass
+  public static void setUpBeforeClass() throws Exception {
     conf = UTIL.getConfiguration();
+    String cps = JMXListener.class.getName() + "," + MyAccessController.class.getName();
+    conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, cps);
+    conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY, cps);
+    rmiRegistryPort = UTIL.randomFreePort();

Review comment:
       While the port might have been 'free' when we got it, by the time we go to use it, it may have been occupied for another. See HBaseTestingUtility#setupMiniKdc where it loops until no BindException. This trick is used in a few places to get around port clash.
   




----------------------------------------------------------------
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



[GitHub] [hbase] Apache-HBase commented on pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on pull request #2286:
URL: https://github.com/apache/hbase/pull/2286#issuecomment-677755141


   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |:----:|----------:|--------:|:--------|
   | +0 :ok: |  reexec  |   1m  4s |  Docker mode activated.  |
   | -0 :warning: |  yetus  |   0m  3s |  Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck  |
   ||| _ Prechecks _ |
   ||| _ master Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   4m  4s |  master passed  |
   | +1 :green_heart: |  compile  |   0m 56s |  master passed  |
   | +1 :green_heart: |  shadedjars  |   6m  3s |  branch has no errors when building our shaded downstream artifacts.  |
   | +1 :green_heart: |  javadoc  |   0m 40s |  master passed  |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   3m 45s |  the patch passed  |
   | +1 :green_heart: |  compile  |   1m  0s |  the patch passed  |
   | +1 :green_heart: |  javac  |   1m  0s |  the patch passed  |
   | +1 :green_heart: |  shadedjars  |   6m  0s |  patch has no errors when building our shaded downstream artifacts.  |
   | +1 :green_heart: |  javadoc  |   0m 36s |  the patch passed  |
   ||| _ Other Tests _ |
   | +1 :green_heart: |  unit  | 216m 44s |  hbase-server in the patch passed.  |
   |  |   | 242m 40s |   |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | Client=19.03.12 Server=19.03.12 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile |
   | GITHUB PR | https://github.com/apache/hbase/pull/2286 |
   | Optional Tests | javac javadoc unit shadedjars compile |
   | uname | Linux 1cdfbf1bddad 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/hbase-personality.sh |
   | git revision | master / 1164531d5a |
   | Default Java | 1.8.0_232 |
   |  Test Results | https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/testReport/ |
   | Max. process+thread count | 2953 (vs. ulimit of 12500) |
   | modules | C: hbase-server U: hbase-server |
   | Console output | https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/console |
   | versions | git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f) |
   | Powered by | Apache Yetus 0.11.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


----------------------------------------------------------------
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



[GitHub] [hbase] ddupg commented on a change in pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

Posted by GitBox <gi...@apache.org>.
ddupg commented on a change in pull request #2286:
URL: https://github.com/apache/hbase/pull/2286#discussion_r474396182



##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/TestJMXConnectorServer.java
##########
@@ -56,39 +58,47 @@
   private static Configuration conf = null;
   private static Admin admin;
   // RMI registry port
-  private static int rmiRegistryPort = 61120;
+  private static int rmiRegistryPort;
   // Switch for customized Accesscontroller to throw ACD exception while executing test case
-  static boolean hasAccess;
+  private volatile static boolean hasAccess;
 
-  @Before
-  public void setUp() throws Exception {
-    UTIL = new HBaseTestingUtility();
+  @BeforeClass
+  public static void setUpBeforeClass() throws Exception {
     conf = UTIL.getConfiguration();
+    String cps = JMXListener.class.getName() + "," + MyAccessController.class.getName();
+    conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, cps);
+    conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY, cps);
+    rmiRegistryPort = UTIL.randomFreePort();

Review comment:
       Thank @saintstack for reviewing.
   
   For JMXConnectorServer starting, only use the default port or specifying port, can't find a free port by retrying. So I use HBaseTestingUtility#randomFreePort to get a free port, which mark ports as taken and don't return repeated ports. This patch may not completely avoid port clash, but at least it can reduce the possibility ?




----------------------------------------------------------------
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



[GitHub] [hbase] saintstack commented on pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

Posted by GitBox <gi...@apache.org>.
saintstack commented on pull request #2286:
URL: https://github.com/apache/hbase/pull/2286#issuecomment-678036735


   `I just saw the code and found that maybe it can be optimized here. It saves 3 mins on my PC and 1 min in Test Results.`
   
   Thanks. Good.


----------------------------------------------------------------
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



[GitHub] [hbase] saintstack commented on a change in pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

Posted by GitBox <gi...@apache.org>.
saintstack commented on a change in pull request #2286:
URL: https://github.com/apache/hbase/pull/2286#discussion_r474406789



##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/TestJMXConnectorServer.java
##########
@@ -56,39 +58,47 @@
   private static Configuration conf = null;
   private static Admin admin;
   // RMI registry port
-  private static int rmiRegistryPort = 61120;
+  private static int rmiRegistryPort;
   // Switch for customized Accesscontroller to throw ACD exception while executing test case
-  static boolean hasAccess;
+  private volatile static boolean hasAccess;
 
-  @Before
-  public void setUp() throws Exception {
-    UTIL = new HBaseTestingUtility();
+  @BeforeClass
+  public static void setUpBeforeClass() throws Exception {
     conf = UTIL.getConfiguration();
+    String cps = JMXListener.class.getName() + "," + MyAccessController.class.getName();
+    conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, cps);
+    conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY, cps);
+    rmiRegistryPort = UTIL.randomFreePort();

Review comment:
       In my experience it is strange how often we meet clashes.  Any chance of catching BindException and retrying?




----------------------------------------------------------------
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



[GitHub] [hbase] Apache-HBase commented on pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on pull request #2286:
URL: https://github.com/apache/hbase/pull/2286#issuecomment-677709327


   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |:----:|----------:|--------:|:--------|
   | +0 :ok: |  reexec  |   1m  0s |  Docker mode activated.  |
   | -0 :warning: |  yetus  |   0m  3s |  Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck  |
   ||| _ Prechecks _ |
   ||| _ master Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   4m 15s |  master passed  |
   | +1 :green_heart: |  compile  |   1m  3s |  master passed  |
   | +1 :green_heart: |  shadedjars  |   6m  5s |  branch has no errors when building our shaded downstream artifacts.  |
   | -0 :warning: |  javadoc  |   0m 42s |  hbase-server in master failed.  |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   3m 59s |  the patch passed  |
   | +1 :green_heart: |  compile  |   1m  5s |  the patch passed  |
   | +1 :green_heart: |  javac  |   1m  5s |  the patch passed  |
   | +1 :green_heart: |  shadedjars  |   5m 41s |  patch has no errors when building our shaded downstream artifacts.  |
   | -0 :warning: |  javadoc  |   0m 39s |  hbase-server in the patch failed.  |
   ||| _ Other Tests _ |
   | +1 :green_heart: |  unit  | 136m 15s |  hbase-server in the patch passed.  |
   |  |   | 162m 58s |   |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | Client=19.03.12 Server=19.03.12 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile |
   | GITHUB PR | https://github.com/apache/hbase/pull/2286 |
   | Optional Tests | javac javadoc unit shadedjars compile |
   | uname | Linux 50b5e3173960 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/hbase-personality.sh |
   | git revision | master / 1164531d5a |
   | Default Java | 2020-01-14 |
   | javadoc | https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/artifact/yetus-jdk11-hadoop3-check/output/branch-javadoc-hbase-server.txt |
   | javadoc | https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/artifact/yetus-jdk11-hadoop3-check/output/patch-javadoc-hbase-server.txt |
   |  Test Results | https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/testReport/ |
   | Max. process+thread count | 3990 (vs. ulimit of 12500) |
   | modules | C: hbase-server U: hbase-server |
   | Console output | https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2286/2/console |
   | versions | git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f) |
   | Powered by | Apache Yetus 0.11.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


----------------------------------------------------------------
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



[GitHub] [hbase] ddupg commented on a change in pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

Posted by GitBox <gi...@apache.org>.
ddupg commented on a change in pull request #2286:
URL: https://github.com/apache/hbase/pull/2286#discussion_r475402597



##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/TestJMXConnectorServer.java
##########
@@ -56,39 +58,47 @@
   private static Configuration conf = null;
   private static Admin admin;
   // RMI registry port
-  private static int rmiRegistryPort = 61120;
+  private static int rmiRegistryPort;
   // Switch for customized Accesscontroller to throw ACD exception while executing test case
-  static boolean hasAccess;
+  private volatile static boolean hasAccess;
 
-  @Before
-  public void setUp() throws Exception {
-    UTIL = new HBaseTestingUtility();
+  @BeforeClass
+  public static void setUpBeforeClass() throws Exception {
     conf = UTIL.getConfiguration();
+    String cps = JMXListener.class.getName() + "," + MyAccessController.class.getName();
+    conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, cps);
+    conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY, cps);
+    rmiRegistryPort = UTIL.randomFreePort();

Review comment:
       The port used to start JMXConnectorServer is obtained from the configuration during cluster startup. And just log even if failed to start JMXConnectorServer because of port clash.
   So if we want to avoid port clash absolutely, restart cluster?




----------------------------------------------------------------
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



[GitHub] [hbase] ddupg commented on pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

Posted by GitBox <gi...@apache.org>.
ddupg commented on pull request #2286:
URL: https://github.com/apache/hbase/pull/2286#issuecomment-678026946


   > Oh, want to say why you are making these changes? You having port clashes running tests? What is the difference in test time after these changes?
   
   I just saw the code and found that maybe it can be optimized here. It saves 3 mins on my PC and 1 min in Test Results.


----------------------------------------------------------------
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



[GitHub] [hbase] infraio commented on a change in pull request #2286: HBASE-24913 Refactor TestJMXConnectorServer

Posted by GitBox <gi...@apache.org>.
infraio commented on a change in pull request #2286:
URL: https://github.com/apache/hbase/pull/2286#discussion_r475093446



##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/TestJMXConnectorServer.java
##########
@@ -56,39 +58,47 @@
   private static Configuration conf = null;
   private static Admin admin;
   // RMI registry port
-  private static int rmiRegistryPort = 61120;
+  private static int rmiRegistryPort;
   // Switch for customized Accesscontroller to throw ACD exception while executing test case
-  static boolean hasAccess;
+  private volatile static boolean hasAccess;
 
-  @Before
-  public void setUp() throws Exception {
-    UTIL = new HBaseTestingUtility();
+  @BeforeClass
+  public static void setUpBeforeClass() throws Exception {
     conf = UTIL.getConfiguration();
+    String cps = JMXListener.class.getName() + "," + MyAccessController.class.getName();
+    conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, cps);
+    conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY, cps);
+    rmiRegistryPort = UTIL.randomFreePort();
+    conf.setInt("master.rmi.registry.port", rmiRegistryPort);
+    conf.setInt("regionserver.rmi.registry.port", rmiRegistryPort);
+    UTIL.startMiniCluster();
+    admin = UTIL.getConnection().getAdmin();
   }
 
-  @After
-  public void tearDown() throws Exception {
-    // Set to true while stopping cluster
-    hasAccess = true;
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
     admin.close();
     UTIL.shutdownMiniCluster();
   }
 
+  @Before
+  public void setUp() {
+    hasAccess = false;

Review comment:
       Seems only the first call will throw AccessDeny exception. Did you know why this design?




----------------------------------------------------------------
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