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
,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
Fields Modifier and Type Field Description protected Configuration
clusterConfiguration
protected ScheduledExecutorService
executor
protected GatewayRetriever<? extends T>
leaderRetriever
protected RestHandlerConfiguration
restConfiguration
-
Fields inherited from class org.apache.flink.runtime.rest.RestServerEndpoint
log, responseHeaders, uploadDir
-
-
Constructor Summary
Constructors Constructor Description WebMonitorEndpoint(GatewayRetriever<? extends T> leaderRetriever, Configuration clusterConfiguration, RestHandlerConfiguration restConfiguration, GatewayRetriever<ResourceManagerGateway> resourceManagerRetriever, TransientBlobService transientBlobService, ScheduledExecutorService executor, MetricFetcher metricFetcher, LeaderElection leaderElection, ExecutionGraphCache executionGraphCache, FatalErrorHandler fatalErrorHandler)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<ArchivedJson>
archiveJsonWithPath(ExecutionGraphInfo executionGraphInfo)
Returns aCollection
ofArchivedJson
s containing JSON responses and their respective REST URL for a given job.static ScheduledExecutorService
createExecutorService(int numThreads, int threadPriority, String componentName)
void
grantLeadership(UUID leaderSessionID)
Callback method which is called by theLeaderElectionService
upon selecting this instance as the new leader.void
handleError(Exception exception)
Callback method which is called byLeaderElectionService
in case of an error in the service thread.protected List<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<Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>>
initializeWebSubmissionHandlers(CompletableFuture<String> localAddressFuture)
void
revokeLeadership()
Callback method which is called by theLeaderElectionService
upon revoking the leadership of a former leader.protected CompletableFuture<Void>
shutDownInternal()
Stops this REST server endpoint.void
startInternal()
Hook to start sub class specific services.-
Methods inherited from class org.apache.flink.runtime.rest.RestServerEndpoint
closeAsync, getRestBaseUrl, getRestPort, getServerAddress, start
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.util.AutoCloseableAsync
close
-
-
-
-
Field Detail
-
leaderRetriever
protected final GatewayRetriever<? extends T extends RestfulGateway> leaderRetriever
-
clusterConfiguration
protected final Configuration clusterConfiguration
-
restConfiguration
protected final RestHandlerConfiguration restConfiguration
-
executor
protected final ScheduledExecutorService executor
-
-
Constructor Detail
-
WebMonitorEndpoint
public WebMonitorEndpoint(GatewayRetriever<? extends T> leaderRetriever, Configuration clusterConfiguration, RestHandlerConfiguration restConfiguration, GatewayRetriever<ResourceManagerGateway> resourceManagerRetriever, TransientBlobService transientBlobService, ScheduledExecutorService executor, MetricFetcher metricFetcher, LeaderElection leaderElection, ExecutionGraphCache executionGraphCache, FatalErrorHandler fatalErrorHandler) throws IOException, ConfigurationException
- Throws:
IOException
ConfigurationException
-
-
Method Detail
-
initializeHandlers
protected List<Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>> initializeHandlers(CompletableFuture<String> localAddressFuture)
Description copied from class:RestServerEndpoint
This method is called at the beginning ofRestServerEndpoint.start()
to setup all handlers that the REST server endpoint implementation requires.- Specified by:
initializeHandlers
in classRestServerEndpoint
- Parameters:
localAddressFuture
- future rest address of the RestServerEndpoint- Returns:
- Collection of AbstractRestHandler which are added to the server endpoint
-
initializeWebSubmissionHandlers
protected Collection<Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>> initializeWebSubmissionHandlers(CompletableFuture<String> localAddressFuture)
-
startInternal
public void startInternal() throws Exception
Description copied from class:RestServerEndpoint
Hook to start sub class specific services.- Specified by:
startInternal
in classRestServerEndpoint
- Throws:
Exception
- if an error occurred
-
shutDownInternal
protected CompletableFuture<Void> shutDownInternal()
Description copied from class:RestServerEndpoint
Stops this REST server endpoint.- Overrides:
shutDownInternal
in classRestServerEndpoint
- Returns:
- Future which is completed once the shut down has been finished.
-
grantLeadership
public void grantLeadership(UUID leaderSessionID)
Description copied from interface:LeaderContender
Callback method which is called by theLeaderElectionService
upon selecting this instance as the new leader. The method is called with the new leader session ID.- Specified by:
grantLeadership
in interfaceLeaderContender
- Parameters:
leaderSessionID
- New leader session ID
-
revokeLeadership
public void revokeLeadership()
Description copied from interface:LeaderContender
Callback method which is called by theLeaderElectionService
upon revoking the leadership of a former leader. This might happen in case that multiple contenders have been granted leadership.- Specified by:
revokeLeadership
in interfaceLeaderContender
-
handleError
public void handleError(Exception exception)
Description copied from interface:LeaderContender
Callback method which is called byLeaderElectionService
in case of an error in the service thread.- Specified by:
handleError
in interfaceLeaderContender
- Parameters:
exception
- Caught exception
-
archiveJsonWithPath
public Collection<ArchivedJson> archiveJsonWithPath(ExecutionGraphInfo executionGraphInfo) throws IOException
Description copied from interface:JsonArchivist
Returns aCollection
ofArchivedJson
s 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:
archiveJsonWithPath
in 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)
-
-