Java Code Examples for org.apache.flink.runtime.util.LeaderRetrievalUtils#retrieveLeaderConnectionInfo()

The following examples show how to use org.apache.flink.runtime.util.LeaderRetrievalUtils#retrieveLeaderConnectionInfo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProcessFailureCancelingITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to wait until the {@link Dispatcher} has set its fencing token.
 *
 * @param rpcService to use to connect to the dispatcher
 * @param haServices high availability services to connect to the dispatcher
 * @return {@link DispatcherGateway}
 * @throws Exception if something goes wrong
 */
static DispatcherGateway retrieveDispatcherGateway(RpcService rpcService, HighAvailabilityServices haServices) throws Exception {
	final LeaderConnectionInfo leaderConnectionInfo = LeaderRetrievalUtils.retrieveLeaderConnectionInfo(haServices.getDispatcherLeaderRetriever(), Time.seconds(10L));

	return rpcService.connect(
		leaderConnectionInfo.getAddress(),
		DispatcherId.fromUuid(leaderConnectionInfo.getLeaderSessionID()),
		DispatcherGateway.class).get();
}
 
Example 2
Source File: ProcessFailureCancelingITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to wait until the {@link Dispatcher} has set its fencing token.
 *
 * @param rpcService to use to connect to the dispatcher
 * @param haServices high availability services to connect to the dispatcher
 * @return {@link DispatcherGateway}
 * @throws Exception if something goes wrong
 */
static DispatcherGateway retrieveDispatcherGateway(RpcService rpcService, HighAvailabilityServices haServices) throws Exception {
	final LeaderConnectionInfo leaderConnectionInfo = LeaderRetrievalUtils.retrieveLeaderConnectionInfo(haServices.getDispatcherLeaderRetriever(), Time.seconds(10L));

	return rpcService.connect(
		leaderConnectionInfo.getAddress(),
		DispatcherId.fromUuid(leaderConnectionInfo.getLeaderSessionID()),
		DispatcherGateway.class).get();
}
 
Example 3
Source File: ProcessFailureCancelingITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to wait until the {@link Dispatcher} has set its fencing token.
 *
 * @param rpcService to use to connect to the dispatcher
 * @param haServices high availability services to connect to the dispatcher
 * @return {@link DispatcherGateway}
 * @throws Exception if something goes wrong
 */
static DispatcherGateway retrieveDispatcherGateway(RpcService rpcService, HighAvailabilityServices haServices) throws Exception {
	final LeaderConnectionInfo leaderConnectionInfo = LeaderRetrievalUtils.retrieveLeaderConnectionInfo(
		haServices.getDispatcherLeaderRetriever(),
		Duration.ofSeconds(10L));

	return rpcService.connect(
		leaderConnectionInfo.getAddress(),
		DispatcherId.fromUuid(leaderConnectionInfo.getLeaderSessionId()),
		DispatcherGateway.class).get();
}
 
Example 4
Source File: RestClusterClient.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public LeaderConnectionInfo getClusterConnectionInfo() throws LeaderRetrievalException {
	return LeaderRetrievalUtils.retrieveLeaderConnectionInfo(
		highAvailabilityServices.getDispatcherLeaderRetriever(),
		timeout);
}
 
Example 5
Source File: MiniClusterClient.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public LeaderConnectionInfo getClusterConnectionInfo() throws LeaderRetrievalException {
	return LeaderRetrievalUtils.retrieveLeaderConnectionInfo(
		highAvailabilityServices.getDispatcherLeaderRetriever(),
		timeout);
}
 
Example 6
Source File: ClusterClient.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the current cluster connection info (may change in case of a HA setup).
 *
 * @return The the connection info to the leader component of the cluster
 * @throws LeaderRetrievalException if the leader could not be retrieved
 */
public LeaderConnectionInfo getClusterConnectionInfo() throws LeaderRetrievalException {
	return LeaderRetrievalUtils.retrieveLeaderConnectionInfo(
		highAvailabilityServices.getJobManagerLeaderRetriever(HighAvailabilityServices.DEFAULT_JOB_ID),
		timeout);
}
 
Example 7
Source File: ClusterClient.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the current cluster connection info (may change in case of a HA setup).
 *
 * @return The the connection info to the leader component of the cluster
 * @throws LeaderRetrievalException if the leader could not be retrieved
 */
public LeaderConnectionInfo getClusterConnectionInfo() throws LeaderRetrievalException {
	return LeaderRetrievalUtils.retrieveLeaderConnectionInfo(
		highAvailabilityServices.getDispatcherLeaderRetriever(),
		timeout);
}