@Override
  public NamedQueueGetResponse getNamedQueueRecords(NamedQueueGetRequest request) {
    if (!isBalancerRejectionRecording) {
      return null;
    }
    List<RecentLogs.BalancerRejection> balancerRejections =
      Arrays.stream(balancerRejectionQueue.toArray(new RecentLogs.BalancerRejection[0]))
        .collect(Collectors.toList());
    // latest records should be displayed first, hence reverse order sorting
    Collections.reverse(balancerRejections);
    int limit = balancerRejections.size();
    if (request.getBalancerRejectionsRequest().hasLimit()) {
      limit =
        Math.min(request.getBalancerRejectionsRequest().getLimit(), balancerRejections.size());
    }
    // filter limit if provided
    balancerRejections = balancerRejections.subList(0, limit);
    final NamedQueueGetResponse namedQueueGetResponse = new NamedQueueGetResponse();
    namedQueueGetResponse.setNamedQueueEvent(BalancerRejectionDetails.BALANCER_REJECTION_EVENT);
    namedQueueGetResponse.setBalancerRejections(balancerRejections);
    return namedQueueGetResponse;
  }
In-memory Queue service provider for Balancer Rejection events
hbase-server/src/main/java/org/apache/hadoop/hbase/namequeues/impl/BalancerRejectionQueueService.java