From e0cd05393929bfba6b775fb2db7c06315e5990f8 Mon Sep 17 00:00:00 2001 From: Sergey Ignatov Date: Wed, 29 May 2019 21:08:28 +0200 Subject: [PATCH] a temporary fix for AppScheduledExecutorServiceTest GitOrigin-RevId: 792eabdb58aaa9ed87f2095943a40d129937ace2 --- .../intellij/openapi/util/LowMemoryWatcherManager.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/platform/util/src/com/intellij/openapi/util/LowMemoryWatcherManager.java b/platform/util/src/com/intellij/openapi/util/LowMemoryWatcherManager.java index 65658973bcfd..ead4b3ce9673 100644 --- a/platform/util/src/com/intellij/openapi/util/LowMemoryWatcherManager.java +++ b/platform/util/src/com/intellij/openapi/util/LowMemoryWatcherManager.java @@ -16,9 +16,7 @@ import java.lang.management.ManagementFactory; import java.lang.management.MemoryNotificationInfo; import java.lang.management.MemoryPoolMXBean; import java.lang.management.MemoryType; -import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; +import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicBoolean; public class LowMemoryWatcherManager implements Disposable { @@ -28,7 +26,7 @@ public class LowMemoryWatcherManager implements Disposable { @NotNull private final ExecutorService myExecutorService; private Future mySubmitted; // guarded by ourJanitor - private final Future myMemoryPoolMXBeansFuture; // guarded by ourJanitor + private final Future myMemoryPoolMXBeansFuture; private final AtomicBoolean myProcessing = new AtomicBoolean(); private final Consumer myJanitor = new Consumer() { @Override @@ -45,7 +43,7 @@ public class LowMemoryWatcherManager implements Disposable { public LowMemoryWatcherManager(@NotNull Executor executorService) { myExecutorService = SequentialTaskExecutor.createSequentialApplicationPoolExecutor("LowMemoryWatcherManager", executorService); - myMemoryPoolMXBeansFuture = myExecutorService.submit(() -> { + myMemoryPoolMXBeansFuture = Executors.newSingleThreadExecutor().submit(() -> { try { for (MemoryPoolMXBean bean : ManagementFactory.getMemoryPoolMXBeans()) { if (bean.getType() == MemoryType.HEAP && bean.isCollectionUsageThresholdSupported() && bean.isUsageThresholdSupported()) {