public static void editRegions(final ThreadPoolExecutor exec,
    final Collection<RegionInfo> regions, final RegionEditTask task) throws IOException {
    final ExecutorCompletionService<Void> completionService = new ExecutorCompletionService<>(exec);
    for (final RegionInfo hri : regions) {
      completionService.submit(new Callable<Void>() {
        @Override
        public Void call() throws IOException {
          task.editRegion(hri);
          return null;
        }
      });
    }

    try {
      for (RegionInfo hri : regions) {
        completionService.take().get();
      }
    } catch (InterruptedException e) {
      throw new InterruptedIOException(e.getMessage());
    } catch (ExecutionException e) {
      throw new IOException(e.getCause());
    }
  }
Execute the task on the specified set of regions.
@param exec    Thread Pool Executor
@param regions {@link RegionInfo} that describes the regions to edit
@param task    {@link RegionFillTask} custom code to edit the region
hbase-server/src/main/java/org/apache/hadoop/hbase/util/ModifyRegionUtils.java