private void flushPendingWrites() {
    for (Map.Entry<Integer, Future<?>> entry : pendingWriteRequests.entrySet()) {
      try {
        entry.getValue().get();
      }
      catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
  }
private void flushPendingWrites()