Workaround visibility restriction of {@code org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution#getExecutorService()}
496505
static synchronized ExecutorService getExecutorService() {
        if (executorService == null) {
            executorService = Executors.newCachedThreadPool(new NamingThreadFactory(new DaemonThreadFactory(), "org.jenkinsci.plugins.pipeline.maven.fix.jenkins49337.GeneralNonBlockingStepExecution"));
        }
        return executorService;
    }
1317883
@Override
	protected void doExecute() throws Exception {
		ExecutorService execService = createExecutorService();
		CompletionService<Boolean> completionService = new ExecutorCompletionService<>(execService);

		for (final File script : scripts) {
			completionService.submit(new Callable<Boolean>() {
				@Override
				public Boolean call() {
					boolean success = false;
					StopWatch stopWatch = new StopWatch();
					stopWatch.start();

					RESULT_LOG.info("Thread " + Thread.currentThread().getName() + ": starting execution of script "
							+ script.getName());

					try {
						success = scriptExecutor.executeScript(script, scriptProperties);
					} catch (Throwable th) {
						LOG.error(th.getMessage(), th);
					} finally {

						LOG.info("SCRIPT EXECUTION " + (success ? "SUCCESSFUL" : "FAILED") + " (" + script + ")");

						RESULT_LOG.info("Thread " + Thread.currentThread().getName() + ": finished execution of script "
								+ script.getName() + " (took "
								+ stopWatch + " H:mm:ss.SSS)");
					}
					return success;
				}
			});
		}

		boolean overallResult = true;
		for (int i = 0, size = scripts.size(); i < size; ++i) {
			if (!completionService.take().get()) {
				overallResult = false;
			}
		}

		shutDownExecutorService(execService);

		if (!overallResult) {
			throw new JFunkExecutionException();
		}
	}
428000
protected ConversionExecutor getPropertyConversionExecutor() {
        if (conversionExecutor == null) {
            conversionExecutor = getConversionService().getConversionExecutor(Object[].class, getPropertyType());
        }
        return conversionExecutor;
    }
673031
public synchronized static ExecutorService getExecutorService() {
        if (executorService == null) {
            executorService = Executors.newCachedThreadPool();
            ((ThreadPoolExecutor) executorService).setMaximumPoolSize(executorPoolSize);
        }
        return executorService;
    }
730295
@Override
	public int deferredEvents() {
		int ret = 0;
		if (!m_shuttingDown && !m_freeze) {
			List<DeferredEvent> deferredEvents;
			try {
				deferredEvents = getWorkflowDAO().getDeferredEvents();
			} catch (RuntimeException e) {
				return 0;
			}
			for (DeferredEvent deferredEvent: deferredEvents) {
				final DeferredEvent finalDeferredEvent = deferredEvent;
				ProcessInstance processInstance = finalDeferredEvent.getProcessInstance();
				getBundleSelector().selectBundle(processInstance);
				List<Lock> locks = ContextUtils.getLocks(processInstance,getLockFactory(),"nz.co.senanque.workflow.Executor.deferredEvents()");
				LockTemplate lockTemplate = new LockTemplate(locks, new LockAction() {
	
					public void doAction() {
						getWorkflowManager().executeDeferredEvent(finalDeferredEvent.getId());
					}});
				if (lockTemplate.doAction()) {
					ret++;
				}
			}
		}
		return ret;
	}
736028
protected synchronized Member getExecutionMember() {
        Iterator<Member> it = memberIterator;
        if (it == null || !it.hasNext()) {
            memberIterator = it = serviceMembers.iterator();
        }
        return it.next();
    }
1191562
private boolean dispatchWorker(Worker worker) {
        ExecutorService executorService = CHFWBundle.getExecutorService();
        if (null == executorService) {
            if (FrameworkState.isValid()) {
                Tr.error(tc, "EXECUTOR_SVC_MISSING");
                throw new RuntimeException("Missing executor service");
            } else {
                // The framework is shutting down: the executor service may be
                // missing by the time the async work is dispatched.
                return false;
            }
        }

        executorService.execute(worker);

        return true;
    }
634589
public WorkflowStrategy getStrategyForWorkflow(
            final WorkflowExecutionItem workflow,
            Map<String, Object> config,
            String projectName
    )
            throws ExecutionServiceException
    {

        String provider = workflow.getWorkflow().getStrategy();
        String s = builtinProviderSynonyms.get(provider);
        if (null != s) {
            provider = s;
        }
        WorkflowStrategy workflowStrategy = providerOfType(provider);
        if (null != config) {
            IRundeckProjectConfig iRundeckProjectConfig = framework.getFrameworkProjectMgr().loadProjectConfig(
                    projectName);

            PropertyResolver resolver = PropertyResolverFactory.createResolver(
                    config.size() > 0 ? PropertyResolverFactory.instanceRetriever(config) : null,
                    PropertyResolverFactory.instanceRetriever(
                            iRundeckProjectConfig.getProjectProperties()
                    ),
                    framework.getPropertyRetriever()
            );

            Description description = DescribableServiceUtil.descriptionForProvider(
                    true,
                    workflowStrategy
            );
            if (description != null) {
                PluginAdapterUtility.configureProperties(
                        resolver,
                        description,
                        workflowStrategy,
                        PropertyScope.Instance
                );
            }
        }
        return workflowStrategy;
    }
629264
@Override
	public AsyncService getAsyncService(TNonblockingTransport transport, String serviceName) throws IkasoaException {
		if (transport == null)
			throw new IllegalArgumentException("'transport' is null !");
		try {
			return StringUtil.isEmpty(serviceName)
					? new AsyncServiceClientImpl((TProtocolFactory) new TCompactProtocol.Factory(), transport)
					: new AsyncServiceClientImpl(new AsyncMultiplexedProtocolFactory(serviceName), transport);
		} catch (IOException e) {
			throw new IkasoaException(e);
		}
	}
218821
public static ScheduledExecutorService defaultExecutorService() {
        ScheduledExecutorService scheduledExecutorService =
                Executors.newScheduledThreadPool(getCpuCount());

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

        return scheduledExecutorService;
    }
185252
public synchronized ScheduledExecutorService getRetryExecutor() {
    if (retryExecutor == null) {
      retryExecutor = Executors.newScheduledThreadPool(RETRY_THREAD_COUNT,
          ThreadUtil.getThreadFactory(RETRY_THREADPOOL_NAME_PATTERN, true));
    }
    return retryExecutor;
  }
285995
public static ObservableExecutor getInstance() {

        return new ObservableExecutor() {

            @Override
            public <T> void execute(final Observable<T> obs) {
                obs.subscribeOn(Schedulers.io())
                        .observeOn(Schedulers.io())
                        .subscribe(new Subscriber<T>() {
                            @Override
                            public void onCompleted() {
                                // Completed, will unsubscribe automatically
                            }

                            @Override
                            public void onError(Throwable e) {
                                // Report errors in doOnError
                            }

                            @Override
                            public void onNext(T t) {
                                // Ignore result
                            }
                        });
            }
        };
    }
1163064
@Deprecated
  public AndroidChannelBuilder scheduledExecutorService(
      ScheduledExecutorService scheduledExecutorService) {
    try {
      OKHTTP_CHANNEL_BUILDER_CLASS
          .getMethod("scheduledExecutorService", ScheduledExecutorService.class)
          .invoke(delegateBuilder, scheduledExecutorService);
      return this;
    } catch (Exception e) {
      throw new RuntimeException(
          "Failed to invoke scheduledExecutorService on delegate builder", e);
    }
  }
814963
private static Throwable getWorkflowCause( Exception exception ){
        Throwable e = exception;
        while( e instanceof WorkflowException ){
            e = e.getCause();
        }
        return e;
    }
434224
@Override
  public TriggerInstance getTriggerInstanceByFlowExecId(final int flowExecId) {
    if (flowExecId == Constants.FAILED_EXEC_ID || flowExecId == Constants.UNASSIGNED_EXEC_ID) {
      return null;
    }
    TriggerInstance triggerInstance = null;
    try {
      final Collection<TriggerInstance> res = this.dbOperator
          .query(SELECT_EXECUTIONS_BY_EXEC_ID,
              new TriggerInstanceHandler(SORT_MODE.SORT_ON_START_TIME_ASC), flowExecId);
      triggerInstance = !res.isEmpty() ? res.iterator().next() : null;
    } catch (final SQLException ex) {
      handleSQLException(ex);
    }
    populateFlowTriggerProperties(triggerInstance);
    return triggerInstance;
  }
125627
private ExecutorService getExecutorService(){
        if (executors == null) {
            try {
                executors = Executors.newCachedThreadPool();
            } catch (Exception e) {
                HMSAgentLog.e("create thread service error:" + e.getMessage());
            }
        }

        return executors;
    }
436857
public T get() {
    Barrier2 bar = _barrier;
    if( bar != null )           // Barrier may be null if task already completed
      bar.join(); // Block on the *barrier* task, which blocks until the fjtask on*Completion code runs completely
    assert isStopped();
    if (_ex!=null)
      throw new RuntimeException((Throwable)AutoBuffer.javaSerializeReadPojo(_ex));
    // Maybe null return, if the started fjtask does not actually produce a result at this Key
    return _result==null ? null : _result.get(); 
  }