[duplicates] enable duplicates analysis in PyCharm/WebStorm/PhpStorm/RubyMine
[idea/community.git] / platform / core-api / src / com / intellij / util / concurrency / EdtExecutorService.java
1 // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
2 package com.intellij.util.concurrency;
3
4 import com.intellij.openapi.application.ModalityState;
5 import org.jetbrains.annotations.NotNull;
6
7 import java.util.concurrent.*;
8
9 /**
10  * An {@link ExecutorService} implementation which
11  * delegates tasks to the EDT for execution.
12  */
13 public abstract class EdtExecutorService extends AbstractExecutorService {
14   @NotNull
15   public static EdtExecutorService getInstance() {
16     return EdtExecutorServiceImpl.INSTANCE;
17   }
18
19   @NotNull
20   public static ScheduledExecutorService getScheduledExecutorInstance() {
21     return EdtScheduledExecutorService.getInstance();
22   }
23
24   public abstract void execute(@NotNull Runnable command, @NotNull ModalityState modalityState);
25   @NotNull
26   public abstract Future<?> submit(@NotNull Runnable command, @NotNull ModalityState modalityState);
27   @NotNull
28   public abstract <T> Future<T> submit(@NotNull Callable<T> task, @NotNull ModalityState modalityState);
29 }