class CurrentJobIdsHandler extends AbstractJsonRequestHandler {

	@Override
	public CompletableFuture<String> handleJsonRequest(
			Map<String, String> pathParams,
			Map<String, String> queryParams,
			JobManagerGateway jobManagerGateway) {

		return CompletableFuture.supplyAsync(
			() -> {
				// we need no parameters, get all requests
				try {
					if (jobManagerGateway != null) {
						CompletableFuture<JobIdsWithStatusOverview> overviewFuture = jobManagerGateway.requestJobsOverview(timeout);
						JobIdsWithStatusOverview overview = overviewFuture.get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);

						StringWriter writer = new StringWriter();
						JsonGenerator gen = JsonFactory.JACKSON_FACTORY.createGenerator(writer);
						gen.setCodec(RestMapperUtils.getStrictObjectMapper());

						gen.writeStartObject();
						gen.writeArrayFieldStart(JobIdsWithStatusOverview.FIELD_NAME_JOBS);

						for (JobIdsWithStatusOverview.JobIdWithStatus jobIdWithStatus : overview.getJobsWithStatus()) {
							gen.writeObject(jobIdWithStatus);
						}

						gen.writeEndArray();
						gen.writeEndObject();

						gen.close();

						return writer.toString();
					}
					else {
						throw new Exception("No connection to the leading JobManager.");
					}
				}
				catch (Exception e) {
					throw new CompletionException(new FlinkException("Failed to fetch list of all running jobs.", e));
				}
			},
			executor);
	}

	public  CurrentJobIdsHandler(Executor executor, Time timeout);

}