public Runtime build() { final ResourceLoader resourceLoader = this.resourceLoader != null ? this.resourceLoader : new MultiLoader(this.classLoader); final ClassFinder classFinder = this.classFinder != null ? this.classFinder : new ResourceLoaderClassFinder(resourceLoader, this.classLoader); final BackendSupplier backendSupplier = this.backendSupplier != null ? this.backendSupplier : new BackendModuleBackendSupplier(resourceLoader, classFinder, this.runtimeOptions); final Plugins plugins = new Plugins(this.classLoader, new PluginFactory(), this.eventBus, this.runtimeOptions); for (final Plugin plugin : additionalPlugins) { plugins.addPlugin(plugin); } final RunnerSupplier runnerSupplier = runtimeOptions.isMultiThreaded() ? new ThreadLocalRunnerSupplier(this.runtimeOptions, eventBus, backendSupplier) : new SingletonRunnerSupplier(this.runtimeOptions, eventBus, backendSupplier); final ExecutorService executor = runtimeOptions.isMultiThreaded() ? Executors.newFixedThreadPool(runtimeOptions.getThreads()) : new SameThreadExecutorService(); final FeatureLoader featureLoader = new FeatureLoader(resourceLoader); final FeatureSupplier featureSupplier = this.featureSupplier != null ? this.featureSupplier : new FeaturePathFeatureSupplier(featureLoader, this.runtimeOptions); final Filters filters = new Filters(this.runtimeOptions); return new Runtime(plugins, this.runtimeOptions, eventBus, filters, runnerSupplier, featureSupplier, executor); } }