Class WebMonitorEndpoint<T extends RestfulGateway>
java.lang.Object
org.apache.flink.runtime.rest.RestServerEndpoint
org.apache.flink.runtime.webmonitor.WebMonitorEndpoint<T>
- Type Parameters:
T- type of the leader gateway
- All Implemented Interfaces:
AutoCloseable,LeaderContender,RestService,JsonArchivist,org.apache.flink.util.AutoCloseableAsync
- Direct Known Subclasses:
DispatcherRestEndpoint,MiniDispatcherRestEndpoint
public class WebMonitorEndpoint<T extends RestfulGateway>
extends RestServerEndpoint
implements LeaderContender, JsonArchivist
Rest endpoint which serves the web frontend REST calls.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.flink.runtime.rest.RestServerEndpoint
RestServerEndpoint.RestHandlerUrlComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.flink.configuration.Configurationprotected final ScheduledExecutorServiceprotected final GatewayRetriever<? extends T>protected final RestHandlerConfigurationFields inherited from class org.apache.flink.runtime.rest.RestServerEndpoint
log, responseHeaders, uploadDir -
Constructor Summary
ConstructorsConstructorDescriptionWebMonitorEndpoint(GatewayRetriever<? extends T> leaderRetriever, org.apache.flink.configuration.Configuration clusterConfiguration, RestHandlerConfiguration restConfiguration, GatewayRetriever<ResourceManagerGateway> resourceManagerRetriever, TransientBlobService transientBlobService, ScheduledExecutorService executor, MetricFetcher metricFetcher, LeaderElection leaderElection, ExecutionGraphCache executionGraphCache, org.apache.flink.runtime.rpc.FatalErrorHandler fatalErrorHandler) -
Method Summary
Modifier and TypeMethodDescriptionarchiveJsonWithPath(ExecutionGraphInfo executionGraphInfo) Returns aCollectionofArchivedJsons containing JSON responses and their respective REST URL for a given job.static ScheduledExecutorServicecreateExecutorService(int numThreads, int threadPriority, String componentName) voidgrantLeadership(UUID leaderSessionID) Callback method which is called by theLeaderElectionServiceupon selecting this instance as the new leader.voidhandleError(Exception exception) Callback method which is called byLeaderElectionServicein case of an error in the service thread.protected List<org.apache.flink.api.java.tuple.Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>> initializeHandlers(CompletableFuture<String> localAddressFuture) This method is called at the beginning ofRestServerEndpoint.start()to setup all handlers that the REST server endpoint implementation requires.protected Collection<org.apache.flink.api.java.tuple.Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>> initializeWebSubmissionHandlers(CompletableFuture<String> localAddressFuture) voidCallback method which is called by theLeaderElectionServiceupon revoking the leadership of a former leader.protected CompletableFuture<Void>Stops this REST server endpoint.voidHook to start sub class specific services.Methods inherited from class org.apache.flink.runtime.rest.RestServerEndpoint
closeAsync, getRestBaseUrl, getRestPort, getServerAddress, startMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.util.AutoCloseableAsync
close
-
Field Details
-
leaderRetriever
-
clusterConfiguration
protected final org.apache.flink.configuration.Configuration clusterConfiguration -
restConfiguration
-
executor
-
-
Constructor Details
-
WebMonitorEndpoint
public WebMonitorEndpoint(GatewayRetriever<? extends T> leaderRetriever, org.apache.flink.configuration.Configuration clusterConfiguration, RestHandlerConfiguration restConfiguration, GatewayRetriever<ResourceManagerGateway> resourceManagerRetriever, TransientBlobService transientBlobService, ScheduledExecutorService executor, MetricFetcher metricFetcher, LeaderElection leaderElection, ExecutionGraphCache executionGraphCache, org.apache.flink.runtime.rpc.FatalErrorHandler fatalErrorHandler) throws IOException, org.apache.flink.util.ConfigurationException - Throws:
IOExceptionorg.apache.flink.util.ConfigurationException
-
-
Method Details
-
initializeHandlers
protected List<org.apache.flink.api.java.tuple.Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>> initializeHandlers(CompletableFuture<String> localAddressFuture) Description copied from class:RestServerEndpointThis method is called at the beginning ofRestServerEndpoint.start()to setup all handlers that the REST server endpoint implementation requires.- Specified by:
initializeHandlersin classRestServerEndpoint- Parameters:
localAddressFuture- future rest address of the RestServerEndpoint- Returns:
- Collection of AbstractRestHandler which are added to the server endpoint
-
initializeWebSubmissionHandlers
protected Collection<org.apache.flink.api.java.tuple.Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>> initializeWebSubmissionHandlers(CompletableFuture<String> localAddressFuture) -
startInternal
Description copied from class:RestServerEndpointHook to start sub class specific services.- Specified by:
startInternalin classRestServerEndpoint- Throws:
Exception- if an error occurred
-
shutDownInternal
Description copied from class:RestServerEndpointStops this REST server endpoint.- Overrides:
shutDownInternalin classRestServerEndpoint- Returns:
- Future which is completed once the shut down has been finished.
-
grantLeadership
Description copied from interface:LeaderContenderCallback method which is called by theLeaderElectionServiceupon selecting this instance as the new leader. The method is called with the new leader session ID.- Specified by:
grantLeadershipin interfaceLeaderContender- Parameters:
leaderSessionID- New leader session ID
-
revokeLeadership
public void revokeLeadership()Description copied from interface:LeaderContenderCallback method which is called by theLeaderElectionServiceupon revoking the leadership of a former leader. This might happen in case that multiple contenders have been granted leadership.- Specified by:
revokeLeadershipin interfaceLeaderContender
-
handleError
Description copied from interface:LeaderContenderCallback method which is called byLeaderElectionServicein case of an error in the service thread.- Specified by:
handleErrorin interfaceLeaderContender- Parameters:
exception- Caught exception
-
archiveJsonWithPath
public Collection<ArchivedJson> archiveJsonWithPath(ExecutionGraphInfo executionGraphInfo) throws IOException Description copied from interface:JsonArchivistReturns aCollectionofArchivedJsons containing JSON responses and their respective REST URL for a given job.The collection should contain one entry for every response that could be generated for the given job, for example one entry for each task. The REST URLs should be unique and must not contain placeholders.
- Specified by:
archiveJsonWithPathin interfaceJsonArchivist- Parameters:
executionGraphInfo-AccessExecutionGraph-related information for which the responses should be generated- Returns:
- Collection containing an ArchivedJson for every response that could be generated for the given job
- Throws:
IOException- thrown if the JSON generation fails
-
createExecutorService
public static ScheduledExecutorService createExecutorService(int numThreads, int threadPriority, String componentName)
-