Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/4691#discussion_r140380156
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/ClusterConfigHandler.java
---
@@ -33,20 +43,27 @@
/**
* Returns the Job Manager's configuration.
*/
-public class JobManagerConfigHandler extends AbstractJsonRequestHandler {
-
- private static final String JOBMANAGER_CONFIG_REST_PATH =
"/jobmanager/config";
+public class ClusterConfigHandler extends AbstractJsonRequestHandler
+ implements LegacyRestHandler<DispatcherGateway,
ClusterConfiguration, EmptyMessageParameters> {
private final Configuration config;
- public JobManagerConfigHandler(Executor executor, Configuration config)
{
+ public ClusterConfigHandler(Executor executor, Configuration config) {
super(executor);
- this.config = config;
+ this.config = Preconditions.checkNotNull(config);
}
@Override
public String[] getPaths() {
- return new String[]{JOBMANAGER_CONFIG_REST_PATH};
+ return new
String[]{ClusterConfigurationHeaders.CLUSTER_CONFIG_REST_PATH};
+ }
+
+ @Override
+ public CompletableFuture<ClusterConfiguration> handleRequest(
+ HandlerRequest<EmptyRequestBody,
EmptyMessageParameters> request,
+ DispatcherGateway gateway) {
+
+ return CompletableFuture.supplyAsync(() ->
ClusterConfiguration.from(config), executor);
--- End diff --
Maybe we could generate the `ClusterConfiguration` instance once at
creation time and then always return this element as a
`CompletableFuture.completedFuture(clusterConfiguration)`.
---