org.apache.flink.runtime.net.ConnectionUtils Java Examples

The following examples show how to use org.apache.flink.runtime.net.ConnectionUtils. 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: LeaderRetrievalUtils.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public static InetAddress findConnectingAddress(
		LeaderRetrievalService leaderRetrievalService,
		FiniteDuration timeout) throws LeaderRetrievalException {
	ConnectionUtils.LeaderConnectingAddressListener listener = new ConnectionUtils.LeaderConnectingAddressListener();

	try {
		leaderRetrievalService.start(listener);

		LOG.info("Trying to select the network interface and address to use " +
				"by connecting to the leading JobManager.");

		LOG.info("TaskManager will try to connect for " + timeout +
				" before falling back to heuristics");

		return listener.findConnectingAddress(timeout);
	} catch (Exception e) {
		throw new LeaderRetrievalException("Could not find the connecting address by " +
				"connecting to the current leader.", e);
	} finally {
		try {
			leaderRetrievalService.stop();
		} catch (Exception fe) {
			LOG.warn("Could not stop the leader retrieval service.", fe);
		}
	}
}
 
Example #2
Source File: LeaderRetrievalUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
public static InetAddress findConnectingAddress(
		LeaderRetrievalService leaderRetrievalService,
		FiniteDuration timeout) throws LeaderRetrievalException {
	ConnectionUtils.LeaderConnectingAddressListener listener = new ConnectionUtils.LeaderConnectingAddressListener();

	try {
		leaderRetrievalService.start(listener);

		LOG.info("Trying to select the network interface and address to use " +
				"by connecting to the leading JobManager.");

		LOG.info("TaskManager will try to connect for " + timeout +
				" before falling back to heuristics");

		return listener.findConnectingAddress(timeout);
	} catch (Exception e) {
		throw new LeaderRetrievalException("Could not find the connecting address by " +
				"connecting to the current leader.", e);
	} finally {
		try {
			leaderRetrievalService.stop();
		} catch (Exception fe) {
			LOG.warn("Could not stop the leader retrieval service.", fe);
		}
	}
}
 
Example #3
Source File: LeaderRetrievalUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
public static InetAddress findConnectingAddress(
		LeaderRetrievalService leaderRetrievalService,
		Duration timeout) throws LeaderRetrievalException {

	ConnectionUtils.LeaderConnectingAddressListener listener = new ConnectionUtils.LeaderConnectingAddressListener();

	try {
		leaderRetrievalService.start(listener);

		LOG.info("Trying to select the network interface and address to use " +
			"by connecting to the leading JobManager.");

		LOG.info("TaskManager will try to connect for " + timeout +
			" before falling back to heuristics");

		return listener.findConnectingAddress(timeout);
	} catch (Exception e) {
		throw new LeaderRetrievalException("Could not find the connecting address by " +
			"connecting to the current leader.", e);
	} finally {
		try {
			leaderRetrievalService.stop();
		} catch (Exception fe) {
			LOG.warn("Could not stop the leader retrieval service.", fe);
		}
	}
}