Source:
public ActionResult<Void> stop(@PathKeysParam PathKeys pathKeys, @ActionParam("force") @Optional("false") boolean force) { String datastreamName = pathKeys.getAsString(KEY_NAME); Datastream datastream = _store.getDatastream(datastreamName); LOG.info("Received request to stop datastream {}", datastream); if (datastream == null) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_404_NOT_FOUND, "Datastream to stopped does not exist: " + datastreamName); } if (!DatastreamStatus.READY.equals(datastream.getStatus()) && !DatastreamStatus.PAUSED.equals(datastream.getStatus())) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_405_METHOD_NOT_ALLOWED, "Can only pause a datastream in READY/PAUSED state: " + datastreamName); } List<Datastream> datastreamsToStop = force ? getGroupedDatastreams(datastream) : Collections.singletonList(datastream); LOG.info("Stop datastreams {}", datastreamsToStop); for (Datastream d : datastreamsToStop) { try { if (DatastreamStatus.READY.equals(datastream.getStatus()) || DatastreamStatus.PAUSED.equals(datastream.getStatus())) { d.setStatus(DatastreamStatus.STOPPED); _store.updateDatastream(d.getName(), d, true); } else { LOG.warn("Cannot stop datastream {}, as it is not in READY/PAUSED state. State: {}", d, datastream.getStatus()); } } catch (DatastreamException e) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, "Could not update datastream to STOPPED state: " + d.getName(), e); } } LOG.info("Completed request for pausing datastream {}", datastream); return new ActionResult<>(HttpStatus.S_200_OK); }

Target:
public ActionResult<Void> stop(@PathKeysParam PathKeys pathKeys, @ActionParam("force") @Optional("false") boolean force) { String datastreamName = pathKeys.getAsString(KEY_NAME); Datastream datastream = _store.getDatastream(datastreamName); LOG.info("Received request to stop datastream {}", datastream); if (datastream == null) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_404_NOT_FOUND, "Datastream to stopped does not exist: " + datastreamName); } if (!DatastreamStatus.READY.equals(datastream.getStatus()) && !DatastreamStatus.PAUSED.equals(datastream.getStatus())) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_405_METHOD_NOT_ALLOWED, "Can only pause a datastream in READY/PAUSED state: " + datastreamName); } List<Datastream> datastreamsToStop = force ? getGroupedDatastreams(datastream) : Collections.singletonList(datastream); LOG.info("Stop datastreams {}", datastreamsToStop); for (Datastream d : datastreamsToStop) { try { if (DatastreamStatus.READY.equals(datastream.getStatus()) || DatastreamStatus.PAUSED.equals(datastream.getStatus())) { d.setStatus(DatastreamStatus.STOPPED); _store.updateDatastream(d.getName(), d, true); } else { LOG.warn("Cannot stop datastream {}, as it is not in READY/PAUSED state. State: {}", d, datastream.getStatus()); } } catch (DatastreamException e) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, "Could not update datastream to STOPPED state: " + d.getName(), e); } } LOG.info("Completed request for stopping datastream {}", datastream); return new ActionResult<>(HttpStatus.S_200_OK); }