Creates an executor that runs the plan locally in a multi-threaded environment.

@return A local executor.
9575
public static PlanExecutor createLocalExecutor(Configuration configuration) {
		Class<? extends PlanExecutor> leClass = loadExecutorClass(LOCAL_EXECUTOR_CLASS);
		
		try {
			return leClass.getConstructor(Configuration.class).newInstance(configuration);
		}
		catch (Throwable t) {
			throw new RuntimeException("An error occurred while loading the local executor ("
					+ LOCAL_EXECUTOR_CLASS + ").", t);
		}
	}
1223314
public CompletableFuture<Void> scheduleForExecution() {
		final ExecutionGraph executionGraph = getVertex().getExecutionGraph();
		final SlotProvider resourceProvider = executionGraph.getSlotProvider();
		final boolean allowQueued = executionGraph.isQueuedSchedulingAllowed();
		return scheduleForExecution(
			resourceProvider,
			allowQueued,
			LocationPreferenceConstraint.ANY,
			Collections.emptySet());
	}
976657
public static ServiceAdapter<ExecutorService> forExecutorService() {
		return new SimpleServiceAdapter<ExecutorService>(false, true) {
			@Override
			protected void start(ExecutorService instance) {
			}

			@Override
			protected void stop(ExecutorService instance) throws Exception {
				List<Runnable> runnables = instance.shutdownNow();
				if (!runnables.isEmpty()) {
					logger.warn("Cancelled tasks: " + runnables);
				}
				if (!instance.isTerminated()) {
					logger.warn("Awaiting termination of " + instance + " ...");
					instance.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
				}
			}
		};
	}
422789
public static ExecutorService createBackgroundExecutor() {
		final ExecutorService executor = Executors.newSingleThreadExecutor(new DaemonThreadFactory(DEFAULT_BACKGROUND_EXECUTOR_NAME));
		BACKGROUND_EXECUTORS.add(executor);
		return executor;
	}
218821
public static ScheduledExecutorService defaultExecutorService() {
        ScheduledExecutorService scheduledExecutorService =
                Executors.newScheduledThreadPool(getCpuCount());

        Runtime.getRuntime().addShutdownHook(new Thread(() -> shutdown(scheduledExecutorService)));

        return scheduledExecutorService;
    }
685944
public DistributedDelayQueue<T>      buildDelayQueue()
    {
        return new DistributedDelayQueue<T>
        (
            client,
            consumer,
            serializer,
            queuePath,
            factory,
            executor,
            Integer.MAX_VALUE,
            lockPath,
            maxItems,
            putInBackground,
            finalFlushMs
        );
    }
969936
protected ScheduledExecutorService createExecutor(ThreadFactory threadFactory)
    {
        ThreadFactory factory = threadFactory == null
            ? DEFAULT_THREAD_FACTORY
            : threadFactory;

        return Executors.newSingleThreadScheduledExecutor(factory);
    }
1116887
public static ExecutorService newSingleThreadPoolExecutor() {
        ExecutorService singleThreadPoolExecutor = Executors.newSingleThreadExecutor();
        EXECUTORS.add(singleThreadPoolExecutor);
        return singleThreadPoolExecutor;
    }
1059785
public ConfigurationBuilder useParallelExecutor(final int availableProcessors) {
        ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("org.reflections-scanner-%d").build();
        setExecutorService(Executors.newFixedThreadPool(availableProcessors, factory));
        return this;
    }
1119526
private ExecutorService _createExecutorService() {
        int producerConnections = Math.max(Integer.valueOf(
            _configuration.getValue(Property.KAFKA_PRODUCER_CONNECTIONS.getName(), Property.KAFKA_PRODUCER_CONNECTIONS.getDefaultValue())), 10);

        return Executors.newFixedThreadPool(producerConnections, new ThreadFactory() {

                AtomicInteger id = new AtomicInteger(0);

                @Override
                public Thread newThread(Runnable r) {
                    return new Thread(r, MessageFormat.format("kafka-producer-worker-{0}", id.getAndIncrement()));
                }
            });
    }
8640
public Iterator<Runnable> buildIterator() {
		return new Iterator<Runnable>() {
			@Override
			public boolean hasNext() {
				return false;
			}

			@Override
			public Runnable next() {
				return null;
			}

			@Override
			public void remove() {
			}
		};
	}
778611
public static ThreadPoolExecutor createDefaultExecutorService() {
        ThreadFactory threadFactory = new ThreadFactory() {
            private int threadCount = 1;

            public Thread newThread(Runnable r) {
                Thread thread = new Thread(r);
                thread.setName("s3-transfer-manager-worker-" + threadCount++);
                return thread;
            }
        };
        return (ThreadPoolExecutor)Executors.newFixedThreadPool(10, threadFactory);
    }
1049108
ThreadPoolExecutor createExecutor(final String threadPrefix, final int workerCount, int queueSize) {
		ThreadFactory threadFactory = new ThreadFactory() {
			private int counter = 0;
			@Override
			public Thread newThread(Runnable runnable) {
				return new Thread(runnable, threadPrefix + "-" + ++counter);
			}
		};
		ThreadPoolExecutor executor = new ThreadPoolExecutor(workerCount, workerCount,
				0, TimeUnit.SECONDS,
				new LinkedBlockingQueue<Runnable>(queueSize), threadFactory);
		return executor;
	}
143951
private ExecutorService createQueryExecutor() {
		ThreadFactory threadFactory = new ThreadFactoryBuilder()
				.setDaemon(true)
				.setNameFormat("Flink " + getServerName() + " Thread %d")
				.build();
		return Executors.newFixedThreadPool(numQueryThreads, threadFactory);
	}
855630
public static ScheduledExecutorService createScheduler() {
		final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1, new DaemonThreadFactory(DEFAULT_SCHEDULER_NAME));
		SCHEDULERS.add(scheduler);
		return scheduler;
	}
383170
public static ThreadPoolExecutor newCachedThreadPool(int corePoolSize,
                                                         int maximumPoolSize,
                                                         BlockingQueue<Runnable> queue) {
        return new ThreadPoolExecutor(corePoolSize,
            maximumPoolSize,
            DateUtils.MILLISECONDS_PER_MINUTE,
            TimeUnit.MILLISECONDS,
            queue);
    }
1233713
public CallOptions withExecutor(@Nullable Executor executor) {
    CallOptions newOptions = new CallOptions(this);
    newOptions.executor = executor;
    return newOptions;
  }