T
- type of the leader gatewaypublic class WebMonitorEndpoint<T extends RestfulGateway> extends RestServerEndpoint implements LeaderContender, JsonArchivist
RestServerEndpoint.RestHandlerUrlComparator
Modifier and Type | Field and Description |
---|---|
protected Configuration |
clusterConfiguration |
protected ExecutorService |
executor |
protected GatewayRetriever<? extends T> |
leaderRetriever |
protected RestHandlerConfiguration |
restConfiguration |
log, responseHeaders, uploadDir
Constructor and Description |
---|
WebMonitorEndpoint(RestServerEndpointConfiguration endpointConfiguration,
GatewayRetriever<? extends T> leaderRetriever,
Configuration clusterConfiguration,
RestHandlerConfiguration restConfiguration,
GatewayRetriever<ResourceManagerGateway> resourceManagerRetriever,
TransientBlobService transientBlobService,
ExecutorService executor,
MetricQueryServiceRetriever metricQueryServiceRetriever,
LeaderElectionService leaderElectionService,
FatalErrorHandler fatalErrorHandler) |
Modifier and Type | Method and Description |
---|---|
Collection<ArchivedJson> |
archiveJsonWithPath(AccessExecutionGraph graph)
Returns a
Collection of ArchivedJson s containing JSON responses and their respective REST URL
for a given job. |
static ExecutorService |
createExecutorService(int numThreads,
int threadPriority,
String componentName) |
String |
getAddress()
Returns the address of the
LeaderContender under which other instances can connect
to it. |
void |
grantLeadership(UUID leaderSessionID)
Callback method which is called by the
LeaderElectionService upon selecting this
instance as the new leader. |
void |
handleError(Exception exception)
Callback method which is called by
LeaderElectionService 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> restAddressFuture)
This method is called at the beginning of
RestServerEndpoint.start() to setup all handlers that the REST server endpoint
implementation requires. |
void |
revokeLeadership()
Callback method which is called by the
LeaderElectionService 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.
|
closeAsync, getRestBaseUrl, getServerAddress, start
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
protected final GatewayRetriever<? extends T extends RestfulGateway> leaderRetriever
protected final Configuration clusterConfiguration
protected final RestHandlerConfiguration restConfiguration
protected final ExecutorService executor
public WebMonitorEndpoint(RestServerEndpointConfiguration endpointConfiguration, GatewayRetriever<? extends T> leaderRetriever, Configuration clusterConfiguration, RestHandlerConfiguration restConfiguration, GatewayRetriever<ResourceManagerGateway> resourceManagerRetriever, TransientBlobService transientBlobService, ExecutorService executor, MetricQueryServiceRetriever metricQueryServiceRetriever, LeaderElectionService leaderElectionService, FatalErrorHandler fatalErrorHandler) throws IOException
IOException
protected List<Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>> initializeHandlers(CompletableFuture<String> restAddressFuture)
RestServerEndpoint
RestServerEndpoint.start()
to setup all handlers that the REST server endpoint
implementation requires.initializeHandlers
in class RestServerEndpoint
restAddressFuture
- future rest address of the RestServerEndpointpublic void startInternal() throws Exception
RestServerEndpoint
startInternal
in class RestServerEndpoint
Exception
- if an error occurredprotected CompletableFuture<Void> shutDownInternal()
RestServerEndpoint
shutDownInternal
in class RestServerEndpoint
public void grantLeadership(UUID leaderSessionID)
LeaderContender
LeaderElectionService
upon selecting this
instance as the new leader. The method is called with the new leader session ID.grantLeadership
in interface LeaderContender
leaderSessionID
- New leader session IDpublic void revokeLeadership()
LeaderContender
LeaderElectionService
upon revoking the
leadership of a former leader. This might happen in case that multiple contenders have
been granted leadership.revokeLeadership
in interface LeaderContender
public String getAddress()
LeaderContender
LeaderContender
under which other instances can connect
to it.getAddress
in interface LeaderContender
public void handleError(Exception exception)
LeaderContender
LeaderElectionService
in case of an error in the
service thread.handleError
in interface LeaderContender
exception
- Caught exceptionpublic Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException
JsonArchivist
Collection
of ArchivedJson
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.
archiveJsonWithPath
in interface JsonArchivist
graph
- AccessExecutionGraph for which the responses should be generatedIOException
- thrown if the JSON generation failspublic static ExecutorService createExecutorService(int numThreads, int threadPriority, String componentName)
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.