private MarkupModelListener createMarkupListener(boolean documentMarkupModel) {
    return new MarkupModelListener() {
      final Queue<RangeHighlighterEx> toRemove = new ConcurrentLinkedDeque<>();
      @Override
      public void afterAdded(@NotNull RangeHighlighterEx highlighter) {
        ErrorStripeMarkersModel.this.afterAdded(highlighter, documentMarkupModel);
      }

      @Override
      public void beforeRemoved(@NotNull RangeHighlighterEx highlighter) {
        toRemove.add(highlighter);
      }

      @Override
      public void afterRemoved(@NotNull RangeHighlighterEx highlighter) {
        while (true) {
          RangeHighlighterEx marker = toRemove.poll();
          if (marker == null) break;
          ErrorStripeMarkerImpl errorStripeMarker = errorStripeForRemovedMarker(highlighter, documentMarkupModel);
          if (errorStripeMarker != null) {
            removeErrorStripeMarker(errorStripeMarker);
          }
        }
      }

      @Override
      public void attributesChanged(@NotNull RangeHighlighterEx highlighter, boolean renderersChanged, boolean fontStyleOrColorChanged) {
        ErrorStripeMarkersModel.this.attributesChanged(highlighter, documentMarkupModel);
      }
    };
  }
private MarkupModelListener createMarkupListener(boolean documentMarkupModel)