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(null,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;
  }
}

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 ( null , 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 ; } }
creates a push processor . the api server is started by this method . the returned push processor is not started .
