Sets the schedulerService.

@param globalScheduler schedulerService
@return this RuntimeEnvironmentBuilder
773968
public RuntimeEnvironmentBuilder schedulerService(Object globalScheduler) {
        if (globalScheduler == null) {
            return this;
        }
        if (!(globalScheduler instanceof GlobalSchedulerService)) {
            throw new IllegalArgumentException("Argument is not of type GlobalSchedulerService");
        }
        _runtimeEnvironment.setSchedulerService((GlobalSchedulerService)globalScheduler);
        return this;
    }
1041096
public IScheduler getSchedulerInstance(Config config, Config runtime)
      throws SchedulerException {
    String schedulerClass = Context.schedulerClass(config);
    IScheduler scheduler;
    try {
      // create an instance of scheduler
      scheduler = ReflectionUtils.newInstance(schedulerClass);
    } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
      throw new SchedulerException(String.format("Failed to instantiate scheduler using class '%s'",
          schedulerClass));
    }

    scheduler.initialize(config, runtime);
    return scheduler;
  }
1332426
public static Scheduler.SchedulerResponse constructSchedulerResponse(boolean isOK) {
    Common.Status.Builder status = Common.Status.newBuilder();
    if (isOK) {
      status.setStatus(Common.StatusCode.OK);
    } else {
      status.setStatus(Common.StatusCode.NOTOK);
    }

    return Scheduler.SchedulerResponse.newBuilder().
        setStatus(status).
        build();
  }
1041402
public static ScheduledExecutorService newScheduledExecutor(int corePoolSize) {
        ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(corePoolSize);
        EXECUTORS.add(scheduledExecutorService);
        return scheduledExecutorService;
    }
1068089
public E setGlobal(E value)
  {
    E oldValue = _globalValue;

    _globalValue = value;

    ClassLoader systemLoader = getSystemClassLoader();

    if (systemLoader instanceof EnvironmentClassLoader)
      ((EnvironmentClassLoader) systemLoader).setAttribute(_varName, value);
    else
      _globalValue = value;

    return oldValue;
  }
471445
public static Schedulers newThreadPoolScheduler(int poolSize) {
        createSingleton();
        Schedulers.increaseNoOfSchedullers();
        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
        CustomizableThreadFactory factory = new CustomizableThreadFactory();
        scheduler.initializeExecutor(factory, new RejectedExecutionHandler() {
            @Override
            public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
                System.out.println("asdsa");
            }
        });
        scheduler.setPoolSize(poolSize);
        instance.setCurrentScheduler(scheduler);
        return instance;
    }
1286268
protected void setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService) {
        if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINER)) {
            LoggingUtil.SESSION_LOGGER_CORE.entering(CLASS_NAME, "setScheduledExecutorService", scheduledExecutorService);
        }
        this.scheduledExecutorService = scheduledExecutorService;
        if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINER)) {
            LoggingUtil.SESSION_LOGGER_CORE.exiting(CLASS_NAME, "setScheduledExecutorService");
        }
    }
886839
public RetryBuilder delay(Delay delay, Scheduler scheduler) {
    this.delay = (delay == null) ? Retry.DEFAULT_DELAY : delay;
    this.scheduler = scheduler;
    return this;
  }
760892
public Config createAdaptorRuntime(SchedulerStateManagerAdaptor adaptor) {
    return Config.newBuilder()
        .put(Key.SCHEDULER_STATE_MANAGER_ADAPTOR, adaptor).build();
  }
286365
public static <T> Observable.Transformer<T, T> applySchedulers(final Scheduler subscribeScheduler) {
        return new Observable.Transformer<T, T>() {
            @Override
            public Observable<T> call(Observable<T> observable) {
                return observable.subscribeOn(subscribeScheduler)
                        .observeOn(AndroidSchedulers.mainThread());
            }
        };
    }
1134266
protected void setDeferrableScheduledExecutor(ServiceReference<ScheduledExecutorService> ref) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "setDeferrableScheduledExecutor", ref);
        deferrableSchedXSvcRef.setReference(ref);
    }
460008
public static String schedule(String schedulingPattern, Runnable task) {
		return scheduler.schedule(schedulingPattern, task);
	}
344214
public ScheduledFuture<?> schedule(Runnable command, TemporalAccessor time)
    {
        ensureWaiterRunning();
        log(logLevel, "schedule(%s, %s)", command, time);
        RunnableScheduledFutureImpl future = new RunnableScheduledFutureImpl(command, Instant.from(time), null, false);
        delayQueue.add(future);
        return future;
    }
442337
@Nonnull
    public static synchronized ScheduledExecutorService get() {
        if (executorService == null) {
            // corePoolSize is set to 10, but will only be created if needed.
            // ScheduledThreadPoolExecutor "acts as a fixed-sized pool using corePoolSize threads"
            // TODO consider also wrapping in ContextResettingExecutorService
             executorService = new ImpersonatingScheduledExecutorService(new ErrorLoggingScheduledThreadPoolExecutor(10, new NamingThreadFactory(new ClassLoaderSanityThreadFactory(new DaemonThreadFactory()), "jenkins.util.Timer")), ACL.SYSTEM);
        }
        return executorService;
    }
656196
public KafkaMsgConsumer setExecutorService(ExecutorService executorService) {
        if (this.executorService != null) {
            this.executorService.shutdown();
        }
        this.executorService = executorService;
        myOwnExecutorService = false;
        return this;
    }
844361
public static Scheduler createScheduler(int threadPoolSize, String annotatedJobsPackageName)
      throws SundialSchedulerException {

    if (scheduler == null) {
      try {
        scheduler = new SchedulerFactory().getScheduler(threadPoolSize, annotatedJobsPackageName);

      } catch (SchedulerException e) {
        throw new SundialSchedulerException("COULD NOT CREATE SUNDIAL SCHEDULER!!!", e);
      }
    }
    return scheduler;
  }
1145450
def init_scheduler(db_uri):
    """"""
    global scheduler
    scheduler = apscheduler.Scheduler()
    scheduler.misfire_grace_time = 3600
    scheduler.add_jobstore(
        sqlalchemy_store.SQLAlchemyJobStore(url=db_uri), 'default')
    scheduler.add_listener(
        job_listener,
        events.EVENT_JOB_EXECUTED | events.EVENT_JOB_MISSED
        | events.EVENT_JOB_ERROR)
    return scheduler