class PipelineStateManager {

  Pipeline finalizePipeline(PipelineID pipelineId)
      throws PipelineNotFoundException {
    Pipeline pipeline = pipelineStateMap.getPipeline(pipelineId);
    if (!pipeline.isClosed()) {
      pipeline = pipelineStateMap
          .updatePipelineState(pipelineId, PipelineState.CLOSED);
      LOG.info("Pipeline {} moved to CLOSED state", pipeline);
    }
    return pipeline;
  }

  public  PipelineStateManager();

}