void (@NotNull PsiElement element, @NotNull AnnotationHolder holder) { if (element instanceof PsiComment && element.getText().equals("//XXX")) { holder.newAnnotation(HighlightSeverity.ERROR, MyFastAnnotator.SWEARING).create(); // sleep after creating annotation to emulate a very big annotator which does a great amount of work after registering annotation // use this contrived form to be able to bail out immediately by modifying toSleepMs in the other thread while (toSleepMs.addAndGet(-100) > 0) { TimeoutUtil.sleep(100); } iDidIt(); } }