IDEA-203054 Thread leaks in tests

This commit is contained in:
Mikhail Sokolov
2018-12-04 16:51:50 +03:00
parent 47fac811d8
commit 3aaa88f249
3 changed files with 25 additions and 13 deletions
@@ -112,9 +112,12 @@ class MultiThreadSearcher implements SESearcher {
* @return {@link ProgressIndicator} that could be used to track and/or cancel searching process
*/
@Override
public ProgressIndicator findMoreItems(Map<SearchEverywhereContributor<?>, Collection<ElementInfo>> alreadyFound, String pattern,
boolean useNonProjectItems, SearchEverywhereContributor<?> contributorToExpand, int newLimit,
Function<SearchEverywhereContributor<?>, SearchEverywhereContributorFilter<?>> filterSupplier) {
public ProgressIndicator findMoreItems(@NotNull Map<SearchEverywhereContributor<?>, Collection<ElementInfo>> alreadyFound,
@NotNull String pattern,
boolean useNonProjectItems,
@NotNull SearchEverywhereContributor<?> contributorToExpand,
int newLimit,
@NotNull Function<SearchEverywhereContributor<?>, SearchEverywhereContributorFilter<?>> filterSupplier) {
ResultsAccumulator accumulator = new ShowMoreResultsAccumulator(alreadyFound, myEqualityProvider, contributorToExpand, newLimit, myListener, myNotificationExecutor);
SearchEverywhereContributorFilter<?> filter = filterSupplier.apply(contributorToExpand);
ProgressIndicator indicator = new ProgressIndicatorBase();
@@ -10,13 +10,17 @@ import java.util.Map;
import java.util.function.Function;
interface SESearcher {
ProgressIndicator search(Map<SearchEverywhereContributor<?>, Integer> contributorsAndLimits, String pattern,
ProgressIndicator search(@NotNull Map<SearchEverywhereContributor<?>, Integer> contributorsAndLimits,
@NotNull String pattern,
boolean useNonProjectItems,
Function<SearchEverywhereContributor<?>, SearchEverywhereContributorFilter<?>> filterSupplier);
@NotNull Function<SearchEverywhereContributor<?>, SearchEverywhereContributorFilter<?>> filterSupplier);
ProgressIndicator findMoreItems(Map<SearchEverywhereContributor<?>, Collection<ElementInfo>> alreadyFound, String pattern,
boolean useNonProjectItems, SearchEverywhereContributor<?> contributorToExpand, int newLimit,
Function<SearchEverywhereContributor<?>, SearchEverywhereContributorFilter<?>> filterSupplier);
ProgressIndicator findMoreItems(@NotNull Map<SearchEverywhereContributor<?>, Collection<ElementInfo>> alreadyFound,
@NotNull String pattern,
boolean useNonProjectItems,
@NotNull SearchEverywhereContributor<?> contributorToExpand,
int newLimit,
@NotNull Function<SearchEverywhereContributor<?>, SearchEverywhereContributorFilter<?>> filterSupplier);
/**
* Search process listener interface
@@ -32,8 +32,10 @@ class SingleThreadSearcher implements SESearcher {
}
@Override
public ProgressIndicator search(Map<SearchEverywhereContributor<?>, Integer> contributorsAndLimits, String pattern, boolean useNonProjectItems,
Function<SearchEverywhereContributor<?>, SearchEverywhereContributorFilter<?>> filterSupplier) {
public ProgressIndicator search(@NotNull Map<SearchEverywhereContributor<?>, Integer> contributorsAndLimits,
@NotNull String pattern,
boolean useNonProjectItems,
@NotNull Function<SearchEverywhereContributor<?>, SearchEverywhereContributorFilter<?>> filterSupplier) {
ProgressIndicator indicator = new ProgressIndicatorBase();
Runnable task = new SearchTask(contributorsAndLimits, pattern, useNonProjectItems, filterSupplier, indicator, myNotificationExecutor,
myNotificationListener, myEqualityProvider);
@@ -43,9 +45,12 @@ class SingleThreadSearcher implements SESearcher {
}
@Override
public ProgressIndicator findMoreItems(Map<SearchEverywhereContributor<?>, Collection<ElementInfo>> alreadyFound, String pattern,
boolean useNonProjectItems, SearchEverywhereContributor<?> contributorToExpand, int newLimit,
Function<SearchEverywhereContributor<?>, SearchEverywhereContributorFilter<?>> filterSupplier) {
public ProgressIndicator findMoreItems(@NotNull Map<SearchEverywhereContributor<?>, Collection<ElementInfo>> alreadyFound,
@NotNull String pattern,
boolean useNonProjectItems,
@NotNull SearchEverywhereContributor<?> contributorToExpand,
int newLimit,
@NotNull Function<SearchEverywhereContributor<?>, SearchEverywhereContributorFilter<?>> filterSupplier) {
ProgressIndicator indicator = new ProgressIndicatorBase();
Runnable task = createShowMoreTask(contributorToExpand, newLimit, pattern, useNonProjectItems, alreadyFound, filterSupplier, indicator);
ApplicationManager.getApplication().executeOnPooledThread(ConcurrencyUtil.underThreadNameRunnable("SE-SingleThread-SearchTask", task));