void () { ThreadingAssertions.assertEventDispatchThread(); // no write action can go through while we test int N = 1000; PsiClassOwner file0 = (PsiJavaFile)myFixture.addFileToProject("C0.java", "class C0 { }"); for (int i=1;i<N ;i++) { int extI = i - 1 - (i - 1) % 10; // 10 inheritors myFixture.addClass("class C" + i + " extends C" + extI + " { }"); } PsiClass class0 = file0.getClasses()[0]; int delayToCancel = 100; for (int i=0;i<1000;i++) { //System.out.println("i = " + i+ "; delayToCancel="+delayToCancel); StandardProgressIndicatorBase progress = new StandardProgressIndicatorBase(); JobScheduler.getScheduler().schedule(progress::cancel, delayToCancel, TimeUnit.MILLISECONDS); try { Collections.nCopies(Runtime.getRuntime().availableProcessors(), "").stream().parallel().forEach(__ -> { Collection<PsiClass> inheritors = Collections.synchronizedSet(new HashSet<>()); ProgressManager.getInstance().executeProcessUnderProgress(()-> { boolean success = ClassInheritorsSearch.search(class0).forEach(new CommonProcessors.CollectProcessor<>(inheritors)); if (N - 1 != inheritors.size() || !success) { assertEquals(N - 1, inheritors.size()); } }, progress); }); myFixture.getPsiManager().dropResolveCaches(); //System.out.println("Iterated all"); delayToCancel--; } catch (ProcessCanceledException e) { //System.out.println("e = " + e); delayToCancel++; } } }