This commit is contained in:
Alexey Kudravtsev
2016-01-14 18:10:46 +03:00
parent 361154efec
commit ea7c3845b8
2 changed files with 6 additions and 5 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -173,7 +173,7 @@ public class BoundedTaskExecutorTest extends TestCase {
Future[] futures = new Future[N];
for (int i = 0; i < N; i++) {
final int finalI = i;
futures[i] = executor.submit(() -> log.append(finalI).append(" "));
futures[i] = executor.submit(() -> log.append(finalI+" "));
}
for (int i = 0; i < N; i++) {
expected.append(i).append(" ");
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ import com.intellij.diagnostic.ThreadDumper;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.util.Disposer;
import com.intellij.util.Function;
import com.intellij.util.ObjectUtils;
import com.intellij.util.ReflectionUtil;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
@@ -71,10 +72,10 @@ public class BoundedTaskExecutor extends AbstractExecutorService {
// for diagnostics
static Object info(Object task) {
if (task instanceof FutureTask) {
task = ReflectionUtil.getField(task.getClass(), task, Callable.class, "callable");
task = ObjectUtils.chooseNotNull(ReflectionUtil.getField(task.getClass(), task, Callable.class, "callable"), task.getClass());
}
if (task instanceof Callable && task.getClass().getName().equals("java.util.concurrent.Executors$RunnableAdapter")) {
task = ReflectionUtil.getField(task.getClass(), task, Runnable.class, "task");
task = ObjectUtils.chooseNotNull(ReflectionUtil.getField(task.getClass(), task, Runnable.class, "task"), task.getClass());
}
return task;
}