Get the runner to use for starting and managing the Opera instance.

@return the current runner
436918
public OperaRunner getRunner() {
    String klassName = (String) options.get(RUNNER).getValue();

    // If no runner is set, use the default one
    if (klassName == null) {
      setRunner(OperaLauncherRunner.class);
      return getRunner();
    }

    Class<?> klass;
    try {
      klass = Class.forName(klassName);
    } catch (ClassNotFoundException e) {
      throw new WebDriverException("Unable to find runner class on classpath: " + klassName);
    }

    Constructor constructor;
    try {
      constructor = klass.getDeclaredConstructor(OperaSettings.class);
    } catch (NoSuchMethodException e) {
      throw new WebDriverException("Invalid constructor in runner: " + klass.getName());
    }

    OperaRunner runner;
    try {
      runner = (OperaRunner) constructor.newInstance(this);
    } catch (InstantiationException e) {
      throw new WebDriverException("Unable to create new instance of runner", e);
    } catch (IllegalAccessException e) {
      throw new WebDriverException("Denied access to runner: " + klass.getName());
    } catch (InvocationTargetException e) {
      throw new WebDriverException("Runner threw exception on construction", e);
    }

    return runner;
  }
30856
public function getServiceBroker()
    {
        if (!$this->serviceBroker && $this->serviceLocator) {
            $this->setServiceBroker($this->serviceLocator->get('ServiceBroker'));
        }
        
        if (!$this->serviceBroker instanceof ServiceBroker) {
            throw new RuntimeException(
                'Unable to execute Job; Job is not correctly initialized (ServiceBroker is not available)');
        }
        
        return $this->serviceBroker;
    }
254009
private String selectRunningService() {
        String selectedServiceId;
        List<String> runningServiceIds = getRunningServiceIds();
        for (int i = 0; i < runningServiceIds.size(); i++) {
            String serviceId = runningServiceIds.get(i);
            OutputStreamFormater.printTabbedValues(9, String.format("[%s]", i), String.format("%s", serviceId));
        }
        String s = readUserInput();
        int pos;
        try {
            pos = Integer.parseInt(s);
            selectedServiceId = runningServiceIds.get(pos);
        } catch (Exception e) {
            throw new IllegalArgumentException(String.format("Invalid Input: %s", s));
        }
        return selectedServiceId;

    }
1176809
protected RunnerResult doRun(Class<? extends LaJob> jobType, LaJobRuntime runtime) {
        // similar to async manager's process
        arrangeThreadCacheContext(runtime);
        arrangePreparedAccessContext(runtime);
        arrangeCallbackContext(runtime);
        final Object variousPreparedObj = prepareVariousContext(runtime);
        final long before = showRunning(runtime);
        Throwable cause = null;
        try {
            debugFw(runtime, "...Calling try clause of job runner");
            hookBefore(runtime);
            debugFw(runtime, "...Calling actuallyRun() of job runner");
            actuallyRun(jobType, runtime);
        } catch (Throwable e) {
            debugFw(runtime, "...Calling catch clause of job runner: {}", e.getClass().getSimpleName());
            final Throwable filtered = filterCause(e);
            cause = filtered;
            showJobException(runtime, before, filtered);
        } finally {
            debugFw(runtime, "...Calling finally clause of job runner");
            hookFinally(runtime, OptionalThing.ofNullable(cause, () -> {
                throw new IllegalStateException("Not found the cause: " + runtime);
            }));
            showFinishing(runtime, before, cause); // should be before clearing because of using them
            clearVariousContext(runtime, variousPreparedObj);
            clearPreparedAccessContext();
            clearCallbackContext();
            clearThreadCacheContext();
        }
        debugFw(runtime, "...Calling createRunnerResult() of job runner");
        return createRunnerResult(runtime, cause);
    }
1121043
public function getRunning()
    {
        $dqb = $this->_em->createQueryBuilder();
        $dqb->select(array('j'))
            ->from('PlaygroundCore\Entity\Cronjob', 'j')
            ->where($dqb->expr()->in('j.status', array(self::STATUS_RUNNING)))
            ->orderBy('j.scheduleTime', 'ASC');

        return $dqb->getQuery()->getResult();
    }
1326216
public function get_current_run() {
        global $CFG;

        // Get number of parallel runs if not passed.
        if (empty($this->currentrun) && ($this->currentrun !== false) && !empty($CFG->behatrunprocess)) {
            $this->currentrun = $CFG->behatrunprocess;
        }

        return $this->currentrun;
    }
63271
public void setRunner(Class<? extends OperaRunner> runner) {
    options.get(RUNNER).setValue(runner.getName());
  }
810232
public ExecutorService getExecutor() {
        ExecutorService executor = executorServiceRef != null ? executorServiceRef.getService() : null;
        if (executor != null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "The Liberty ExecutorService is being used to run asynch reactive work");
            }
            return executor;
        } else {
            // For unit testing
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "The ForkJoinPool.commonPool is being used to run asynch reactive work");
            }
            return ForkJoinPool.commonPool();

        }
    }
173501
JobRunner getRunner(JobInstance ji)
    {
        if (runnerCache.containsKey(ji.getJdId()))
        {
            return runnerCache.get(ji.getJdId());
        }

        for (JobRunner runner : runners)
        {
            if (runner.canRun(ji))
            {
                runnerCache.put(ji.getJdId(), runner);
                return runner;
            }
        }

        throw new JqmRuntimeException("there is no runner able to run job definition " + ji.getJD().getApplicationName());
    }
936379
public SyncLazyFuture<X> withRunningThread() {
        if (state != null) return this;
        Thread thread = new Thread(SyncLazyFuture.this.getClass().getName() + ".withRunningThread") {
            @Override
            public void run() {
                try {
                    SyncLazyFuture.this.internalCalc();
                } catch (ExecutionException | InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        thread.start();
        return this;
    }
261391
@SuppressWarnings(UNUSED)
    @CheckForNull
    @Exported
    public Run getFirstBuild() {
        Run retVal = null;
        for (Job job : getAllJobs()) {
            Run run = job.getFirstBuild();
            if (run != null && (retVal == null || run.getTimestamp().before(retVal.getTimestamp()))) {
                retVal = run;
            }
        }
        return retVal;
    }
277170
public function getRunner()
    {
        if (null === $this->runner) {
            $runner = $this->getContainer()
                ->get('middleware.runner')
                ->setRequest($this->getRequest())
            ;
            $this->setRunner($runner);
        }
        return $this->runner;
    }
222379
public Result run(Runner runner) {
        Result result = new Result();
        RunListener listener = result.createListener();
        notifier.addFirstListener(listener);
        try {
            notifier.fireTestRunStarted(runner.getDescription());
            runner.run(notifier);
            notifier.fireTestRunFinished(result);
        } finally {
            removeListener(listener);
        }
        return result;
    }
1263170
private static TimeseriesQueryRunnerFactory getTimeseriesQueryRunnerFactory() {
        TimeseriesQueryQueryToolChest toolChest =
                new TimeseriesQueryQueryToolChest(noopIntervalChunkingQueryRunnerDecorator());
        TimeseriesQueryEngine engine = new TimeseriesQueryEngine();
        return new TimeseriesQueryRunnerFactory(toolChest, engine, NOOP_QUERYWATCHER);
    }
786099
protected function obtainRunnerFile(): string
    {
        $moduleInfos = $this->loadInfos;
        $runnerFile  = '';

        if (property_exists($moduleInfos, 'runner')) {
            $runnerFile = (string) $moduleInfos->runner;
        }

        if (empty($runnerFile)) {
            return '';
        }

        $runnerFile = MODULES_DIR.$this->name.'/'.$runnerFile;
        if (!file_exists($runnerFile)) {
            throw new Exception(
                'Runner file for module '.$this->name.' not found.',
                $this::ERR_RUNNER_FILE_NOT_FOUND
            );
        }

        return $runnerFile;
    }
797369
def DetermineRunner(bbdir):
    ''''''
    try:
        import buildbot_worker.scripts.runner
        tacfile = os.path.join(bbdir, 'buildbot.tac')

        if os.path.exists(tacfile):
            with open(tacfile, 'r') as f:
                contents = f.read()
                if 'import Worker' in contents:
                    return buildbot_worker.scripts.runner.run

    except ImportError:
        # Use the default
        pass

    import buildbot.scripts.runner
    return buildbot.scripts.runner.run
675856
@CheckForNull
    public WorkUnit getCurrentWorkUnit() {
        lock.readLock().lock();
        try {
            return workUnit;
        } finally {
            lock.readLock().unlock();
        }
    }