docs: private synchronized PipelineInterpreter.State reloadAndSave() {
          // this classloader will hold all generated rule classes
          PipelineClassloader commonClassLoader = allowCodeGeneration ? new PipelineClassloader() : null;
  
          // read all rules and parse them
          Map<String, Rule> ruleNameMap = Maps.newHashMap();
          ruleService.loadAll().forEach(ruleDao -> {
              Rule rule;
              try {
                  rule = pipelineRuleParser.parseRule(ruleDao.id(), ruleDao.source(), false, commonClassLoader);
              } catch (ParseException e) {
                  rule = Rule.alwaysFalse("Failed to parse rule: " + ruleDao.id());
              }
              ruleNameMap.put(rule.name(), rule);
          });
  
          // read all pipelines and parse them
          ImmutableMap.Builder<String, Pipeline> pipelineIdMap = ImmutableMap.builder();
          pipelineService.loadAll().forEach(pipelineDao -> {
              Pipeline pipeline;
              try {
                  pipeline = pipelineRuleParser.parsePipeline(pipelineDao.id(), pipelineDao.source());
              } catch (ParseException e) {
                  pipeline = Pipeline.empty("Failed to parse pipeline" + pipelineDao.id());
              }
              //noinspection ConstantConditions
              pipelineIdMap.put(pipelineDao.id(), resolvePipeline(pipeline, ruleNameMap));
          });
  
          final ImmutableMap<String, Pipeline> currentPipelines = pipelineIdMap.build();
  
          // read all stream connections of those pipelines to allow processing messages through them
          final HashMultimap<String, Pipeline> connections = HashMultimap.create();
          for (PipelineConnections streamConnection : pipelineStreamConnectionsService.loadAll()) {
              streamConnection.pipelineIds().stream()
                      .map(currentPipelines::get)
                      .filter(Objects::nonNull)
                      .forEach(pipeline -> connections.put(streamConnection.streamId(), pipeline));
          }
          ImmutableSetMultimap<String, Pipeline> streamPipelineConnections = ImmutableSetMultimap.copyOf(connections);
  
          final PipelineInterpreter.State newState = stateFactory.newState(currentPipelines, streamPipelineConnections);
          latestState.set(newState);
          return newState;
      }