use of com.intellij.util.concurrency.AppScheduledExecutorService in project intellij-community by JetBrains.
the class ApplicationImpl method dispose.
@Override
public void dispose() {
HeavyProcessLatch.INSTANCE.stopThreadPrioritizing();
fireApplicationExiting();
ShutDownTracker.getInstance().ensureStopperThreadsFinished();
disposeComponents();
AppScheduledExecutorService service = (AppScheduledExecutorService) AppExecutorUtil.getAppScheduledExecutorService();
service.shutdownAppScheduledExecutorService();
super.dispose();
// dispose it last
Disposer.dispose(myLastDisposable);
if (gatherStatistics) {
//noinspection TestOnlyProblems
LOG.info(writeActionStatistics());
LOG.info(ActionUtil.ActionPauses.STAT.statistics());
//noinspection TestOnlyProblems
LOG.info(((AppScheduledExecutorService) AppExecutorUtil.getAppScheduledExecutorService()).statistics() + "; ProcessIOExecutorService threads: " + ((ProcessIOExecutorService) ProcessIOExecutorService.INSTANCE).getThreadCounter());
}
}
use of com.intellij.util.concurrency.AppScheduledExecutorService in project intellij-community by JetBrains.
the class _LastInSuiteTest method testProjectLeak.
public void testProjectLeak() throws Exception {
boolean guiTestMode = Boolean.getBoolean("idea.test.guimode");
if (guiTestMode) {
final Application application = ApplicationManager.getApplication();
TransactionGuard.getInstance().submitTransactionAndWait(() -> {
IdeEventQueue.getInstance().flushQueue();
((ApplicationImpl) application).exit(true, true, false);
});
ShutDownTracker.getInstance().waitFor(100, TimeUnit.SECONDS);
return;
}
UIUtil.invokeAndWaitIfNeeded((Runnable) () -> {
try {
LightPlatformTestCase.initApplication();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
PlatformTestUtil.cleanupAllProjects();
ApplicationImpl application = (ApplicationImpl) ApplicationManager.getApplication();
System.out.println(application.writeActionStatistics());
System.out.println(ActionUtil.ActionPauses.STAT.statistics());
System.out.println(((AppScheduledExecutorService) AppExecutorUtil.getAppScheduledExecutorService()).statistics());
System.out.println("ProcessIOExecutorService threads created: " + ((ProcessIOExecutorService) ProcessIOExecutorService.INSTANCE).getThreadCounter());
application.setDisposeInProgress(true);
LightPlatformTestCase.disposeApplication();
UIUtil.dispatchAllInvocationEvents();
});
try {
LeakHunter.checkProjectLeak();
Disposer.assertIsEmpty(true);
} catch (AssertionError | Exception e) {
captureMemorySnapshot();
throw e;
}
try {
Disposer.assertIsEmpty(true);
} catch (AssertionError | Exception e) {
captureMemorySnapshot();
throw e;
}
}
use of com.intellij.util.concurrency.AppScheduledExecutorService in project intellij-community by JetBrains.
the class PerformanceWatcher method initComponent.
@Override
public void initComponent() {
if (shouldWatch()) {
final AppScheduledExecutorService service = (AppScheduledExecutorService) AppExecutorUtil.getAppScheduledExecutorService();
service.setNewThreadListener(new Consumer<Thread>() {
private final int ourReasonableThreadPoolSize = Registry.intValue("core.pooled.threads");
@Override
public void consume(Thread thread) {
if (service.getBackendPoolExecutorSize() > ourReasonableThreadPoolSize && ApplicationInfoImpl.getShadowInstance().isEAP()) {
File file = dumpThreads("newPooledThread/", true);
LOG.info("Not enough pooled threads" + (file != null ? "; dumped threads into file '" + file.getPath() + "'" : ""));
}
}
});
ApplicationManager.getApplication().executeOnPooledThread(() -> cleanOldFiles(myLogDir, 0));
for (MemoryPoolMXBean bean : ManagementFactory.getMemoryPoolMXBeans()) {
if ("Code Cache".equals(bean.getName())) {
watchCodeCache(bean);
break;
}
}
}
}
Aggregations