Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
268,600
void (String msg) { long start = System.currentTimeMillis(); while (true) { List<Thread> alive = Thread.getAllStackTraces().keySet().stream() .filter(thread -> thread.getName().startsWith(AppScheduledExecutorService.POOLED_THREAD_PREFIX)) .filter(thread -> thread.getState() == Thread.State.RUNNABLE) .filter(thread -> t...
awaitAppPoolQuiescence
268,601
void () { maxThreads.accumulateAndGet(running.incrementAndGet(), Math::max); try { if (finalI % 100 == 0) { TimeoutUtil.sleep(1); } } finally { running.decrementAndGet(); } }
run
268,602
String () { return "iteration " + finalI; }
toString
268,603
void () { maxThreads.accumulateAndGet(running.incrementAndGet(), Math::max); try { Thread.yield(); } finally { running.decrementAndGet(); } }
run
268,604
String () { return "check for " + finalI; }
toString
268,605
void () { maxThreads.accumulateAndGet(running.incrementAndGet(), Math::max); try { Thread.yield(); } finally { running.decrementAndGet(); } }
run
268,606
String () { return "check 2 for " + finalI; }
toString
268,607
void () { try { allStarted.await(); } catch (InterruptedException e) { throw new RuntimeException(e); } }
run
268,608
String () { return "warmup"; }
toString
268,609
void () { workers.add(Thread.currentThread()); }
run
268,610
String () { return "Runnable test "+finalI; }
toString
268,611
void () { ExecutorService executor = AppExecutorUtil.createBoundedApplicationPoolExecutor(getPoolName(),AppExecutorUtil.getAppExecutorService(), 1); Throwable error = LoggedErrorProcessor.executeAndReturnLoggedError(() -> { try { AtomicBoolean executed = new AtomicBoolean(); executor.execute(() -> { try { throw new Err...
testErrorsThrownInFiredAndForgottenTaskMustBeLogged
268,612
void () { ExecutorService executor = AppExecutorUtil.createBoundedApplicationPoolExecutor(getPoolName(),AppExecutorUtil.getAppExecutorService(), 1); executor.shutdown(); assertTrue(executor.isShutdown()); executor.shutdown(); assertTrue(executor.isShutdown()); }
testShutdownMustBeIdempotentByExecutorServiceContract
268,613
boolean () { return false; }
runInDispatchThread
268,614
void (TestTask task) { assertEquals(TaskState.SUCCEEDED, task.getState()); }
assertSucceeded
268,615
void (TestTask[] tasks, TaskState state) { for (TestTask task : tasks) { assertEquals(state, task.getState()); } }
assertTaskState
268,616
void () { TimeoutUtil.sleep(50); }
sleep50
268,617
void (final int intervalMs) { TimeoutUtil.sleep(myRandom.nextInt(intervalMs) + 1); }
sleepX
268,618
void (ProgressIndicator indicator) { double r = 0; for (int i = 0; i < 10_000; i++) { r += Math.sin(i); } if (r == 0) { throw new IllegalStateException(); } }
execute
268,619
TaskState () { return myState.get(); }
getState
268,620
boolean () { return myState.get().isComplete(); }
isComplete
268,621
void (@NotNull ProgressIndicator indicator) { myState.compareAndSet(TaskState.CREATED, TaskState.RUNNING); execute(indicator); }
run
268,622
void () { myState.compareAndSet(TaskState.RUNNING, TaskState.CANCELLED); }
onCancel
268,623
void () { myState.compareAndSet(TaskState.RUNNING, TaskState.SUCCEEDED); }
onSuccess
268,624
void (@NotNull Throwable error) { myState.compareAndSet(TaskState.RUNNING, TaskState.EXCEPTION); }
onThrowable
268,625
void () { mySemaphore.release(); assertNotSame(TaskState.RUNNING, myState.get()); assertNotSame(TaskState.CREATED, myState.get()); }
onFinished
268,626
boolean () { return false; }
isHeadless
268,627
void (int count, IntConsumer task) { for (int i = 0; i < count; i++) { int threadIndex = i; myThreads.add(ApplicationManager.getApplication().executeOnPooledThread(() -> task.accept(threadIndex))); } }
run
268,628
void () { try { for (Future<?> thread : myThreads) { thread.get(); } } catch (Exception e) { throw new RuntimeException(e); } }
finish
268,629
void (ProgressIndicator indicator) { sleep50(); indicator.cancel(); }
execute
268,630
void (ProgressIndicator indicator) { sleep50(); throw new NullPointerException("NPE"); }
execute
268,631
void (@NotNull ProgressIndicator indicator) { succeeded[0]++; semaphore.release(); }
run
268,632
void (ProgressIndicator indicator) { sleep50(); throw new ProcessCanceledException(); }
execute
268,633
void (ProgressIndicator indicator) { sleep50(); throw new RuntimeException(); }
execute
268,634
void (@NotNull ProgressIndicator indicator) { Assert.assertFalse(bool[0]); bool[0] = true; sleepX(17); semaphore.release(); Assert.assertTrue(bool[0]); bool[0] = false; }
run
268,635
void () { testValidThread(new Invoker.EDT(parent)); }
testValidOnEDT
268,636
void () { testValidThread(new Invoker.Background(parent, 10)); }
testValidBgPool
268,637
void () { testValidThread(Invoker.forBackgroundThreadWithReadAction(parent)); }
testValidBgThread
268,638
void (Invoker invoker) { CountDownLatch latch = new CountDownLatch(1); test(invoker, latch, error -> countDown(latch, 0, error, "task on invalid thread", invoker::isValidThread)); }
testValidThread
268,639
void () { testInvokeLater(new Invoker.EDT(parent)); }
testInvokeLaterOnEDT
268,640
void () { testInvokeLater(new Invoker.Background(parent, 10)); }
testInvokeLaterOnBgPool
268,641
void () { testInvokeLater(Invoker.forBackgroundThreadWithReadAction(parent)); }
testInvokeLaterOnBgThread
268,642
void (Invoker invoker) { CountDownLatch latch = new CountDownLatch(1); test(invoker, latch, error -> { AtomicBoolean current = new AtomicBoolean(false); register(invoker.invokeLater(() -> countDown(latch, 100, error, "task is not done before subtask", current::get))); current.set(true); }); }
testInvokeLater
268,643
void () { testSchedule(new Invoker.EDT(parent)); }
testScheduleOnEDT
268,644
void () { testSchedule(new Invoker.Background(parent, 10)); }
testScheduleOnBgPool
268,645
void () { testSchedule(Invoker.forBackgroundThreadWithReadAction(parent)); }
testScheduleOnBgThread
268,646
void (Invoker invoker) { CountDownLatch latch = new CountDownLatch(1); test(invoker, latch, error -> { AtomicBoolean current = new AtomicBoolean(false); register(invoker.invokeLater(() -> countDown(latch, 0, error, "task is not done before subtask", current::get), 200)); register(invoker.invokeLater(() -> current.set(t...
testSchedule
268,647
void () { testInvokeLaterIfNeeded(new Invoker.EDT(parent)); }
testInvokeLaterIfNeededOnEDT
268,648
void () { testInvokeLaterIfNeeded(new Invoker.Background(parent, 10)); }
testInvokeLaterIfNeededOnBgPool
268,649
void () { testInvokeLaterIfNeeded(Invoker.forBackgroundThreadWithReadAction(parent)); }
testInvokeLaterIfNeededOnBgThread
268,650
void (Invoker invoker) { CountDownLatch latch = new CountDownLatch(1); test(invoker, latch, error -> { AtomicBoolean current = new AtomicBoolean(true); register(invoker.invoke(() -> countDown(latch, 100, error, "task is done before subtask", current::get))); current.set(false); }); }
testInvokeLaterIfNeeded
268,651
void () { testReadAction(Invoker.forBackgroundThreadWithReadAction(parent), true, true); }
testReadActionYes
268,652
void () { testReadAction(Invoker.forBackgroundPoolWithoutReadAction(parent), false, false); }
testReadActionNo
268,653
boolean (CountDownLatch latch, AtomicReference<? super String> error, String message, boolean expected) { if (expected == getApplication().isReadAccessAllowed()) return true; StringBuilder sb = new StringBuilder(expected ? "No expected" : "Unexpected"); error.set(sb.append(" read action ").append(message).append(" acqu...
isExpected
268,654
void (Invoker invoker, boolean expectedBefore, boolean expectedAfter) { CountDownLatch latch = new CountDownLatch(1); test(invoker, latch, error -> { if (isExpected(latch, error, "before", expectedBefore)) { getApplication().runReadAction(() -> { register(invoker.invoke(() -> { if (isExpected(latch, error, "after", exp...
testReadAction
268,655
void () { testCompute(new Invoker.EDT(parent)); }
testComputeOnEDT
268,656
void () { testCompute(new Invoker.Background(parent, 10)); }
testComputeOnBgPool
268,657
void () { testCompute(Invoker.forBackgroundThreadWithReadAction(parent)); }
testComputeOnBgThread
268,658
void (@NotNull Invoker invoker) { CountDownLatch latch = new CountDownLatch(1); test(invoker, latch, error -> { AtomicBoolean later = new AtomicBoolean(); String expected = Long.toHexString(System.currentTimeMillis()); register(invoker.compute(() -> { try { if (invoker.isValidThread()) { Thread.sleep(100); if (!later.g...
testCompute
268,659
void () { testComputeLater(new Invoker.EDT(parent)); }
testComputeLaterOnEDT
268,660
void () { testComputeLater(new Invoker.Background(parent, 10)); }
testComputeLaterOnBgPool
268,661
void () { testComputeLater(Invoker.forBackgroundThreadWithReadAction(parent)); }
testComputeLaterOnBgThread
268,662
void (@NotNull Invoker invoker) { CountDownLatch latch = new CountDownLatch(1); test(invoker, latch, error -> { AtomicBoolean later = new AtomicBoolean(); String expected = Long.toHexString(System.currentTimeMillis()); register(invoker.computeLater(() -> { try { if (invoker.isValidThread()) { Thread.sleep(100); if (lat...
testComputeLater
268,663
void () { testRestartOnPCE(new Invoker.EDT(parent)); }
testRestartOnEDT
268,664
void () { testRestartOnPCE(new Invoker.Background(parent, 10)); }
testRestartOnBgPool
268,665
void () { testRestartOnPCE(Invoker.forBackgroundThreadWithReadAction(parent)); }
testRestartOnBgThread
268,666
void (Invoker invoker) { AtomicInteger value = new AtomicInteger(10); CountDownLatch latch = new CountDownLatch(1); test(invoker, latch, error -> { if (0 < value.decrementAndGet()) throw new ProcessCanceledException(); latch.countDown(); }); }
testRestartOnPCE
268,667
void () { testQueue(new Invoker.EDT(parent), true); }
testQueueOnEDT
268,668
void () { testQueue(new Invoker.Background(parent, 10), false); }
testQueueOnBgPool
268,669
void () { testQueue(Invoker.forBackgroundThreadWithReadAction(parent), true); }
testQueueOnBgThread
268,670
void (Invoker invoker, boolean ordered) { CountDownLatch latch = new CountDownLatch(2); test(invoker, latch, error -> { long first = ordered ? 2 : 1; register(invoker.invokeLater(() -> countDown(latch, 100, error, "unexpected task order", () -> first == latch.getCount()))); long second = ordered ? 1 : 2; register(invok...
testQueue
268,671
void () { testThreadChanging(new Invoker.EDT(parent)); }
testThreadChangingOnEDT
268,672
void () { testThreadChanging(new Invoker.Background(parent, 10)); }
testThreadChangingOnBgPool
268,673
void () { testThreadChanging(Invoker.forBackgroundThreadWithReadAction(parent)); }
testThreadChangingOnBgThread
268,674
void (Invoker invoker) { testThreadChanging(invoker, invoker, true); }
testThreadChanging
268,675
void () { testThreadChanging(new Invoker.EDT(parent), new Invoker.EDT(parent), true); }
testThreadChangingOnEDTfromEDT
268,676
void () { testThreadChanging(new Invoker.EDT(parent), new Invoker.Background(parent, 10), false); }
testThreadChangingOnEDTfromBgPool
268,677
void () { testThreadChanging(new Invoker.EDT(parent), Invoker.forBackgroundThreadWithReadAction(parent), false); }
testThreadChangingOnEDTfromBgThread
268,678
void () { testThreadChanging(new Invoker.Background(parent, 10), new Invoker.EDT(parent), false); }
testThreadChangingOnBgPoolFromEDT
268,679
void () { testThreadChanging(new Invoker.Background(parent, 10), new Invoker.Background(parent, 10), false); }
testThreadChangingOnBgPoolFromBgPool
268,680
void () { testThreadChanging(new Invoker.Background(parent, 10), Invoker.forBackgroundThreadWithReadAction(parent), false); }
testThreadChangingOnBgPoolFromBgThread
268,681
void () { testThreadChanging(Invoker.forBackgroundThreadWithReadAction(parent), new Invoker.EDT(parent), false); }
testThreadChangingOnBgThreadFromEDT
268,682
void () { testThreadChanging(Invoker.forBackgroundThreadWithReadAction(parent), new Invoker.Background(parent, 10), false); }
testThreadChangingOnBgThreadFromBgPool
268,683
void () { testThreadChanging(Invoker.forBackgroundThreadWithReadAction(parent), Invoker.forBackgroundThreadWithReadAction(parent), false); }
testThreadChangingOnBgThreadFromBgThread
268,684
void (Invoker foreground, Invoker background, Boolean equal) { CountDownLatch latch = new CountDownLatch(1); test(foreground, latch, error -> process(background, foreground, Thread::currentThread, thread -> countDown(latch, 0, error, "unexpected thread", () -> isExpected(thread, equal)))); }
testThreadChanging
268,685
boolean (Thread thread, Boolean equal) { if (equal != null) return equal.equals(thread == Thread.currentThread()); return true; // debug only: thread may be reused }
isExpected
268,686
void (Invoker invoker, CountDownLatch latch, Consumer<? super AtomicReference<String>> consumer) { Assert.assertFalse("EDT should not be used to start this test", invoker instanceof Invoker.EDT && isEventDispatchThread()); AtomicReference<String> error = new AtomicReference<>(); register(invoker.invokeLater(() -> consu...
test
268,687
void (CountDownLatch latch, long ms, AtomicReference<? super String> error, String message, BooleanSupplier success) { try { if (ms > 0) Thread.sleep(ms); } catch (InterruptedException ignore) { } finally { if (!success.getAsBoolean()) error.set(message); latch.countDown(); } }
countDown
268,688
void () { Disposable parent = Disposer.newDisposable("disposed"); testInterrupt(parent, new Invoker.EDT(parent), promise -> Disposer.dispose(parent)); }
testDisposeOnEDT
268,689
void () { Disposable parent = Disposer.newDisposable("disposed"); testInterrupt(parent, Invoker.forBackgroundThreadWithReadAction(parent), promise -> Disposer.dispose(parent)); }
testDisposeOnBgThread
268,690
void () { Disposable parent = Disposer.newDisposable("disposed"); testInterrupt(parent, new Invoker.Background(parent, 10), promise -> Disposer.dispose(parent)); }
testDisposeOnBgPool
268,691
void () { Disposable parent = Disposer.newDisposable("cancelled"); testInterrupt(parent, new Invoker.EDT(parent), promise -> promise.cancel()); }
testCancelOnEDT
268,692
void () { Disposable parent = Disposer.newDisposable("cancelled"); testInterrupt(parent, Invoker.forBackgroundThreadWithReadAction(parent), promise -> promise.cancel()); }
testCancelOnBgThread
268,693
void () { Disposable parent = Disposer.newDisposable("cancelled"); testInterrupt(parent, new Invoker.Background(parent, 10), promise -> promise.cancel()); }
testCancelOnBgPool
268,694
void (Disposable parent, Invoker invoker, Consumer<CancellablePromise<?>> interrupt) { InfiniteTask task = new InfiniteTask(interrupt == null); CancellablePromise<?> promise = invoker.invokeLater(task, 10); try { wait(task.started, "cannot start infinite task"); if (interrupt != null) interrupt.accept(promise); wait(ta...
testInterrupt
268,695
void (CancellablePromise<?> promise, String error) { try { promise.blockingGet(100, TimeUnit.MILLISECONDS); } catch (Throwable throwable) { throw new AssertionError(error, throwable); } finally { promise.cancel(); } }
wait
268,696
boolean () { return obsolete && started.isDone(); }
isObsolete
268,697
void () { try { started.setResult(null); long startedAt = System.currentTimeMillis(); while (10000 > System.currentTimeMillis() - startedAt) ProgressManager.checkCanceled(); infinite = true; } finally { finished.setResult(null); } }
run
268,698
void () { FileTypeIndexImpl index = FileBasedIndexExtension.EXTENSION_POINT_NAME.findExtension(FileTypeIndexImpl.class); VirtualFile file = myFixture.configureByText("foo.test", "abc").getVirtualFile(); FileTypeIndex.getFiles(PlainTextFileType.INSTANCE, GlobalSearchScope.allScope(getProject())); int version = index.get...
testAddFileType
268,699
void () { FileBasedIndex.getInstance().ensureUpToDate(FileTypeIndex.NAME, getProject(), GlobalSearchScope.allScope(getProject())); }
ensureUpToDate