public static Future executeOnPooledThread()

in src/java/org/jetbrains/plugins/clojure/repl/ClojureReplProcessHandler.java [72:96]


  public static Future<?> executeOnPooledThread(Runnable task) {
    final Application application = ApplicationManager.getApplication();

    if (application != null) {
      return application.executeOnPooledThread(task);
    } else {
      if (ourThreadExecutorsService == null) {
        ourThreadExecutorsService = new ThreadPoolExecutor(
            10,
            Integer.MAX_VALUE,
            60L,
            TimeUnit.SECONDS,
            new SynchronousQueue<Runnable>(),
            new ThreadFactory() {
              @SuppressWarnings({"HardCodedStringLiteral"})
              public Thread newThread(Runnable r) {
                return new Thread(r, "OSProcessHandler pooled thread");
              }
            }
        );
      }

      return ourThreadExecutorsService.submit(task);
    }
  }