Validates the supplied service is not shutdown.

@param executorService
Service to check.
@return The service.
979292
public static <T extends ExecutorService> T requireNotShutdown(final T executorService) {
	if (executorService.isShutdown()) {
	    throw new IllegalArgumentException("ExecutorService is shutdown");
	}
	return executorService;
    }
759066
public static I_CmsValidationService getValidationService(String name) throws CmsException {

        try {
            Class<?> cls = Class.forName(name, false, I_CmsValidationService.class.getClassLoader());
            if (!I_CmsValidationService.class.isAssignableFrom(cls)) {
                throw new CmsIllegalArgumentException(
                    Messages.get().container(Messages.ERR_VALIDATOR_INCORRECT_TYPE_1, name));
            }
            return (I_CmsValidationService)cls.newInstance();
        } catch (ClassNotFoundException e) {
            throw new CmsException(Messages.get().container(Messages.ERR_VALIDATOR_INSTANTIATION_FAILED_1, name), e);
        } catch (InstantiationException e) {
            throw new CmsException(Messages.get().container(Messages.ERR_VALIDATOR_INSTANTIATION_FAILED_1, name), e);
        } catch (IllegalAccessException e) {
            throw new CmsException(Messages.get().container(Messages.ERR_VALIDATOR_INSTANTIATION_FAILED_1, name), e);
        }
    }
122909
public synchronized void shutdown() {
        if (!shutdown) {

            if (ownExecutor) {
                // if the executor was created by this instance, it has
                // to be shutdown
                getExecutorService().shutdownNow();
            }
            if (task != null) {
                task.cancel(false);
            }

            shutdown = true;
        }
    }
948827
public static void setDefaultExecutorService(
            ExecutorService defaultExecutorService) {
        // If the timer executor service is set to the default
        // executor service, adjust it to the new value as well.
        if (timerExecutorService == Components.defaultExecutorService) {
            timerExecutorService = defaultExecutorService;
        }
        Components.defaultExecutorService = defaultExecutorService;
    }
671032
public ScheduledExecutorService getScheduledExecutorService() {
        ScheduledExecutorService sRef = scheduledExecutorService.get();
        if (sRef == null) {
            throw new IllegalStateException("ScheduledExecutorService service is unavailable");
        }
        return sRef;
    }
360285
public static @NonNull CompletableExecutorService completableDecorator(final @NonNull ExecutorService executorService) {
    if(executorService instanceof CompletableExecutorService) {
      return (CompletableExecutorService) executorService;
    }
    return new CompletableDecorator(executorService);
  }
249755
public static ExecutorService getExecutorService() {
        HttpDispatcher f = instance.get().get();
        if (f == null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "HttpDispatcher instance not found");
            }
            return null;
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "HttpDispatcher instance: " + f.toString());
            }
            return f.executorService;
        }

    }
603552
public static BlockingQueue<Runnable> getThreadQueue(
            ExecutorService executorService) {
        if (executorService instanceof ThreadPoolExecutor)
            return ((ThreadPoolExecutor) executorService).getQueue();
        throw JMExceptionManager.handleExceptionAndReturnRuntimeEx(log,
                new IllegalArgumentException(
                        "Unsupported ExecutorService - Use ThrJMThread.newThreadPool Or newSingleThreadPool To Get ExecutorService !!!"),
                "getThreadQueue", executorService);
    }
1250821
@Reference(name = "executorService", service = ExecutorService.class, policy = ReferencePolicy.DYNAMIC)
    protected void setExecutorService(ServiceReference<ExecutorService> executorService) {
        this.executorService.setReference(executorService);
    }
910089
private boolean checkFailover() throws InterruptedException {
    boolean isPrimary = isPrimaryServiceCached();
    if (!isPrimary && isPrimaryService()) {
      this.servicePair.setPrimaryOfferService(this);
      return true;
    }
    return false;
  }
959951
public static void executorShutDown(ExecutorService executorService, long timeOutSec) {
        try {
            executorService.shutdown();
            executorService.awaitTermination(timeOutSec, TimeUnit.SECONDS);
        } catch(Exception e) {
            logger.warn("Error while stoping executor service.", e);
        }
    }
904447
@Override
    public Future<?> submit(Runnable task) {
        ExecutorService executor = getScheduledExecutor();
        try {
            return executor.submit(errorHandlingTask(task, false));
        } catch (RejectedExecutionException ex) {
            throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
        }
    }
923168
@Override
    public ServiceCacheBuilder<T> threadFactory(ThreadFactory threadFactory)
    {
        this.threadFactory = threadFactory;
        this.executorService = null;
        return this;
    }
673031
public synchronized static ExecutorService getExecutorService() {
        if (executorService == null) {
            executorService = Executors.newCachedThreadPool();
            ((ThreadPoolExecutor) executorService).setMaximumPoolSize(executorPoolSize);
        }
        return executorService;
    }
1246594
public<V> Future<V> submit(Callable<V> task)
    {
        Preconditions.checkState(isOpen.get(), "CloseableExecutorService is closed");

        InternalFutureTask<V> futureTask = new InternalFutureTask<V>(new FutureTask<V>(task));
        executorService.execute(futureTask);
        return futureTask;
    }
926027
@EachBean(ExecutorConfiguration.class)
    @Bean(preDestroy = "shutdown")
    public ExecutorService executorService(ExecutorConfiguration executorConfiguration) {
        ExecutorType executorType = executorConfiguration.getType();
        switch (executorType) {
            case FIXED:
                return executorConfiguration
                    .getThreadFactoryClass()
                    .flatMap(InstantiationUtils::tryInstantiate)
                    .map(factory -> Executors.newFixedThreadPool(executorConfiguration.getNumberOfThreads(), factory))
                    .orElse(Executors.newFixedThreadPool(executorConfiguration.getNumberOfThreads(), threadFactory));

            case CACHED:
                return executorConfiguration
                    .getThreadFactoryClass()
                    .flatMap(InstantiationUtils::tryInstantiate)
                    .map(Executors::newCachedThreadPool)
                    .orElse(Executors.newCachedThreadPool(threadFactory));

            case SCHEDULED:
                return executorConfiguration
                    .getThreadFactoryClass()
                    .flatMap(InstantiationUtils::tryInstantiate)
                    .map(factory -> Executors.newScheduledThreadPool(executorConfiguration.getCorePoolSize(), factory))
                    .orElse(Executors.newScheduledThreadPool(executorConfiguration.getCorePoolSize(), threadFactory));

            case WORK_STEALING:
                return Executors.newWorkStealingPool(executorConfiguration.getParallelism());

            default:
                throw new IllegalStateException("Could not create Executor service for enum value: " + executorType);
        }
    }
98333
public ServiceBroker stop() {

		// Stop internal components
		stop(transporter);
		stop(serviceRegistry);
		stop(eventbus);
		stop(serviceInvoker);
		stop(contextFactory);
		stop(strategyFactory);
		stop(uidGenerator);

		// Shutdown thread pools
		if (config.isShutDownThreadPools()) {
			ExecutorService executor = config.getExecutor();
			if (executor != null && !executor.isShutdown() && !executor.isTerminated()) {
				try {
					executor.shutdownNow();
				} catch (Exception ignored) {
				}
			}
			logger.info("Task Executor Service stopped.");
			ScheduledExecutorService scheduler = config.getScheduler();
			if (scheduler != null && !scheduler.isShutdown() && !scheduler.isTerminated()) {
				try {
					scheduler.shutdownNow();
				} catch (Exception ignored) {
				}
			}
			logger.info("Task Scheduler Service stopped.");
		}
		return this;
	}