mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
capitalize known pool names, add weak assertion requirng capitalization
GitOrigin-RevId: 22eecaae4db57409d444934820f3371c59ea24b9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e5c047b620
commit
74021d421d
@@ -244,7 +244,7 @@ private fun startApp(app: ApplicationImpl,
|
||||
|
||||
@ApiStatus.Internal
|
||||
fun createExecutorToPreloadServices(): Executor {
|
||||
return AppExecutorUtil.createBoundedApplicationPoolExecutor("preload services", Runtime.getRuntime().availableProcessors(), false)
|
||||
return AppExecutorUtil.createBoundedApplicationPoolExecutor("Preload Services", Runtime.getRuntime().availableProcessors(), false)
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
@@ -40,9 +40,7 @@ public abstract class Invoker implements Disposable {
|
||||
private volatile boolean disposed;
|
||||
|
||||
private Invoker(@NotNull String prefix, @NotNull Disposable parent, @NotNull ThreeState useReadAction) {
|
||||
StringBuilder sb = new StringBuilder().append(UID.getAndIncrement()).append(".Invoker.").append(prefix);
|
||||
if (useReadAction != ThreeState.UNSURE) sb.append(".ReadAction=").append(useReadAction);
|
||||
description = sb.append(": ").append(parent).toString();
|
||||
description = "Invoker." + UID.getAndIncrement()+"."+prefix + (useReadAction != ThreeState.UNSURE ? ".ReadAction="+useReadAction : "") + ": "+parent;
|
||||
this.useReadAction = useReadAction;
|
||||
register(parent, this);
|
||||
}
|
||||
|
||||
+3
-3
@@ -186,7 +186,7 @@ public class NonBlockingReadActionTest extends LightPlatformTestCase {
|
||||
}
|
||||
|
||||
public void testDoNotBlockExecutorThreadDuringWriteAction() throws Exception {
|
||||
ExecutorService executor = AppExecutorUtil.createBoundedApplicationPoolExecutor("a", 1);
|
||||
ExecutorService executor = AppExecutorUtil.createBoundedApplicationPoolExecutor("TestDoNotBlockExecutorThreadDuringWriteAction", 1);
|
||||
Semaphore mayFinish = new Semaphore();
|
||||
Promise<Void> promise = ReadAction.nonBlocking(() -> {
|
||||
while (!mayFinish.waitFor(1)) {
|
||||
@@ -215,7 +215,7 @@ public class NonBlockingReadActionTest extends LightPlatformTestCase {
|
||||
}
|
||||
|
||||
public void testDoNotLeakSecondCancelledCoalescedAction() throws Exception {
|
||||
Executor executor = AppExecutorUtil.createBoundedApplicationPoolExecutor(getName(), 10);
|
||||
Executor executor = AppExecutorUtil.createBoundedApplicationPoolExecutor("TestDoNotLeakSecondCancelledCoalescedAction", 10);
|
||||
|
||||
Object leak = new Object(){};
|
||||
CancellablePromise<String> p = ReadAction.nonBlocking(() -> "a").coalesceBy(leak).submit(executor);
|
||||
@@ -354,7 +354,7 @@ public class NonBlockingReadActionTest extends LightPlatformTestCase {
|
||||
}
|
||||
|
||||
public void testExceptionInsideAsyncComputationIsLogged() throws Exception {
|
||||
BoundedTaskExecutor executor = (BoundedTaskExecutor)AppExecutorUtil.createBoundedApplicationPoolExecutor(getName(), 10);
|
||||
BoundedTaskExecutor executor = (BoundedTaskExecutor)AppExecutorUtil.createBoundedApplicationPoolExecutor("TestExceptionInsideAsyncComputationIsLogged", 10);
|
||||
|
||||
AtomicReference<Throwable> loggedError = watchLoggedExceptions();
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ public final class BoundedTaskExecutor extends AbstractExecutorService {
|
||||
|
||||
BoundedTaskExecutor(@NotNull String name, @NotNull Executor backendExecutor, int maxThreads, boolean changeThreadName) {
|
||||
this(name, backendExecutor, maxThreads, changeThreadName, null);
|
||||
if (name.isEmpty() || !Character.isUpperCase(name.charAt(0))) {
|
||||
Logger.getInstance(getClass()).warn("Pool name must be capitalized but got: '" + name + "'", new IllegalArgumentException());
|
||||
}
|
||||
}
|
||||
|
||||
public BoundedTaskExecutor(@NotNull String name, @NotNull Executor backendExecutor, int maxThreads, boolean changeThreadName, @Nullable Comparator<Runnable> comparator) {
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ public class RequestsMergerTest extends TestCase {
|
||||
}
|
||||
|
||||
private static class SimpleExecutor implements Consumer<Runnable> {
|
||||
private final ExecutorService myExecutor = SequentialTaskExecutor.createSequentialApplicationPoolExecutor("req merge test");
|
||||
private final ExecutorService myExecutor = SequentialTaskExecutor.createSequentialApplicationPoolExecutor("Req Merge Test");
|
||||
|
||||
@Override
|
||||
public void consume(Runnable runnable) {
|
||||
|
||||
Reference in New Issue
Block a user