code: private void executeInPool(@NotNull String name, @NotNull Runnable task, @Nullable Runnable finalizer, boolean pooled) {
      if (pool.isShutdown()) {
        log.warn("Thread pool is shutdown");
        if (finalizer != null) {
          finalizer.run();
        }
        return;
      }
      if (!pooled) {
        log.debug("Begin: " + name);
        try {
          task.run();
        } catch (Throwable e) {
          log.error("Execute exception: " + e);
          if (finalizer != null) {
            finalizer.run();
          }
          throw e;
        } finally {
          if (finalizer != null) {
            finalizer.run();
          }
          log.debug("End: " + name);
        }
        return;
      }
      try {
        pool.execute(new Runnable() {
          @Override
          public void run() {
            executeInPool(name, task, finalizer, false);
          }
  
          @Override
          public String toString() {
            return name;
          }
        });
      } catch (RejectedExecutionException e) {
        if (pool.isShutdown()) {
          log.warn("Thread pool is shutdown");
        } else {
          executeInPool(name, task, finalizer, false);
        }
      } catch (Throwable e) {
        log.error("Execute in pool exception: " + e);
        if (finalizer != null) {
          finalizer.run();
        }
        throw e;
      }
    }
docs: Schedule task in thread pool.
  <p>
  If pool reject task - task will execute immediately in current thread.
  <p>
  If pool is shutdown - task will not run, but finalizer will executed.
  
  @param name      Task name for debug
  @param task      Task runnable
  @param finalizer Finalizer to execute like 'try-final' block