public void start(int poolSize) {
    try {
      LOG.info("hive local dir: {}", hiveLocalDir.getAbsolutePath());
      FileUtils.deleteQuietly(hiveLocalDir);

      File derbyLogFile = new File(hiveLocalDir, "derby.log");
      System.setProperty("derby.stream.error.file", derbyLogFile.getAbsolutePath());

      TServerSocket socket = new TServerSocket(port);
      this.server = newThriftServer(socket, poolSize, hiveConf);
      this.executorService = Executors.newSingleThreadExecutor();
      this.executorService.submit(() -> server.serve());

      // in Hive3, setting this as a system prop ensures that it will be picked up whenever a new
      // HiveConf is created
      System.setProperty(
          HiveConf.ConfVars.METASTOREURIS.varname,
          hiveConf.getVar(HiveConf.ConfVars.METASTOREURIS));

      this.clientPool = AuthenticatedHiveClientPool.createHiveMetaStoreClient(hiveConf);
      started = true;
    } catch (Exception e) {
      throw new RuntimeException("Cannot start TestHiveMetastore", e);
    }
  }
Starts a TestHiveMetastore with a provided connection pool size.

@param poolSize The number of threads in the executor pool
amoro-common/src/test/java/org/apache/amoro/hive/HMSMockServer.java