@Test public void build() throws Exception { try (final PullProcessorPipeline pipeline = new PipelineBuilder(Configuration.DEFAULT) .build()) { assertThat(pipeline.getMetricRegistry().getApi(), instanceOf(ApiServer.class)); } }
public PushProcessorPipeline build(List<PushProcessorSupplier> processor_suppliers) throws Exception { ApiServer api = null; PushMetricRegistryInstance registry = null; final List<PushProcessor> processors = new ArrayList<>(processor_suppliers.size()); try { final EndpointRegistration epr; if (epr_ == null) epr = api = new ApiServer(api_sockaddr_); else epr = epr_; registry = cfg_.create(PushMetricRegistryInstance::new, epr); for (PushProcessorSupplier pps : processor_suppliers) processors.add(pps.build(epr)); if (history_ != null) registry.setHistory(history_); if (api != null) api.start(); return new PushProcessorPipeline(registry, collect_interval_seconds_, processors); } catch (Exception ex) { try { if (api != null) api.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } try { if (registry != null) registry.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } for (PushProcessor pp : processors) { try { pp.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } } throw ex; } }
PipelineBuilder { public PushProcessorPipeline build(List<PushProcessorSupplier> processor_suppliers) throws Exception { ApiServer api = null; PushMetricRegistryInstance registry = null; final List<PushProcessor> processors = new ArrayList<>(processor_suppliers.size()); try { final EndpointRegistration epr; if (epr_ == null) epr = api = new ApiServer(api_sockaddr_); else epr = epr_; registry = cfg_.create(PushMetricRegistryInstance::new, epr); for (PushProcessorSupplier pps : processor_suppliers) processors.add(pps.build(epr)); if (history_ != null) registry.setHistory(history_); if (api != null) api.start(); return new PushProcessorPipeline(registry, collect_interval_seconds_, processors); } catch (Exception ex) { try { if (api != null) api.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } try { if (registry != null) registry.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } for (PushProcessor pp : processors) { try { pp.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } } throw ex; } } }
PipelineBuilder { public PushProcessorPipeline build(List<PushProcessorSupplier> processor_suppliers) throws Exception { ApiServer api = null; PushMetricRegistryInstance registry = null; final List<PushProcessor> processors = new ArrayList<>(processor_suppliers.size()); try { final EndpointRegistration epr; if (epr_ == null) epr = api = new ApiServer(api_sockaddr_); else epr = epr_; registry = cfg_.create(PushMetricRegistryInstance::new, epr); for (PushProcessorSupplier pps : processor_suppliers) processors.add(pps.build(epr)); if (history_ != null) registry.setHistory(history_); if (api != null) api.start(); return new PushProcessorPipeline(registry, collect_interval_seconds_, processors); } catch (Exception ex) { try { if (api != null) api.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } try { if (registry != null) registry.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } for (PushProcessor pp : processors) { try { pp.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } } throw ex; } } PipelineBuilder(@NonNull Configuration cfg);  PipelineBuilder(File dir, Reader reader);  PipelineBuilder(File file); }
PipelineBuilder { public PushProcessorPipeline build(List<PushProcessorSupplier> processor_suppliers) throws Exception { ApiServer api = null; PushMetricRegistryInstance registry = null; final List<PushProcessor> processors = new ArrayList<>(processor_suppliers.size()); try { final EndpointRegistration epr; if (epr_ == null) epr = api = new ApiServer(api_sockaddr_); else epr = epr_; registry = cfg_.create(PushMetricRegistryInstance::new, epr); for (PushProcessorSupplier pps : processor_suppliers) processors.add(pps.build(epr)); if (history_ != null) registry.setHistory(history_); if (api != null) api.start(); return new PushProcessorPipeline(registry, collect_interval_seconds_, processors); } catch (Exception ex) { try { if (api != null) api.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } try { if (registry != null) registry.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } for (PushProcessor pp : processors) { try { pp.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } } throw ex; } } PipelineBuilder(@NonNull Configuration cfg);  PipelineBuilder(File dir, Reader reader);  PipelineBuilder(File file); PipelineBuilder withApiPort(int api_port); PipelineBuilder withApiSockaddr(@NonNull InetSocketAddress api_sockaddr); PipelineBuilder withApi(EndpointRegistration epr); PipelineBuilder withHistory(CollectHistory history); PipelineBuilder withCollectIntervalSeconds(int seconds); PushProcessorPipeline build(List<PushProcessorSupplier> processor_suppliers); PushProcessorPipeline build(PushProcessorSupplier processor_supplier); PullProcessorPipeline build(); }
PipelineBuilder { public PushProcessorPipeline build(List<PushProcessorSupplier> processor_suppliers) throws Exception { ApiServer api = null; PushMetricRegistryInstance registry = null; final List<PushProcessor> processors = new ArrayList<>(processor_suppliers.size()); try { final EndpointRegistration epr; if (epr_ == null) epr = api = new ApiServer(api_sockaddr_); else epr = epr_; registry = cfg_.create(PushMetricRegistryInstance::new, epr); for (PushProcessorSupplier pps : processor_suppliers) processors.add(pps.build(epr)); if (history_ != null) registry.setHistory(history_); if (api != null) api.start(); return new PushProcessorPipeline(registry, collect_interval_seconds_, processors); } catch (Exception ex) { try { if (api != null) api.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } try { if (registry != null) registry.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } for (PushProcessor pp : processors) { try { pp.close(); } catch (Exception ex1) { ex.addSuppressed(ex1); } } throw ex; } } PipelineBuilder(@NonNull Configuration cfg);  PipelineBuilder(File dir, Reader reader);  PipelineBuilder(File file); PipelineBuilder withApiPort(int api_port); PipelineBuilder withApiSockaddr(@NonNull InetSocketAddress api_sockaddr); PipelineBuilder withApi(EndpointRegistration epr); PipelineBuilder withHistory(CollectHistory history); PipelineBuilder withCollectIntervalSeconds(int seconds); PushProcessorPipeline build(List<PushProcessorSupplier> processor_suppliers); PushProcessorPipeline build(PushProcessorSupplier processor_supplier); PullProcessorPipeline build(); static final int DEFAULT_API_PORT; static final int DEFAULT_COLLECT_INTERVAL_SECONDS; }