Java Code Examples for org.apache.flink.configuration.JobManagerOptions#PORT

The following examples show how to use org.apache.flink.configuration.JobManagerOptions#PORT . 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: HighAvailabilityServicesUtils.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the JobManager's hostname and port extracted from the given
 * {@link Configuration}.
 *
 * @param configuration Configuration to extract the JobManager's address from
 * @return The JobManager's hostname and port
 * @throws ConfigurationException if the JobManager's address cannot be extracted from the configuration
 */
public static Tuple2<String, Integer> getJobManagerAddress(Configuration configuration) throws ConfigurationException {

	final String hostname = configuration.getString(JobManagerOptions.ADDRESS);
	final int port = configuration.getInteger(JobManagerOptions.PORT);

	if (hostname == null) {
		throw new ConfigurationException("Config parameter '" + JobManagerOptions.ADDRESS +
			"' is missing (hostname/address of JobManager to connect to).");
	}

	if (port <= 0 || port >= 65536) {
		throw new ConfigurationException("Invalid value for '" + JobManagerOptions.PORT +
			"' (port of the JobManager actor system) : " + port +
			".  it must be greater than 0 and less than 65536.");
	}

	return Tuple2.of(hostname, port);
}
 
Example 2
Source File: HighAvailabilityServicesUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the JobManager's hostname and port extracted from the given
 * {@link Configuration}.
 *
 * @param configuration Configuration to extract the JobManager's address from
 * @return The JobManager's hostname and port
 * @throws ConfigurationException if the JobManager's address cannot be extracted from the configuration
 */
public static Tuple2<String, Integer> getJobManagerAddress(Configuration configuration) throws ConfigurationException {

	final String hostname = configuration.getString(JobManagerOptions.ADDRESS);
	final int port = configuration.getInteger(JobManagerOptions.PORT);

	if (hostname == null) {
		throw new ConfigurationException("Config parameter '" + JobManagerOptions.ADDRESS +
			"' is missing (hostname/address of JobManager to connect to).");
	}

	if (port <= 0 || port >= 65536) {
		throw new ConfigurationException("Invalid value for '" + JobManagerOptions.PORT +
			"' (port of the JobManager actor system) : " + port +
			".  it must be greater than 0 and less than 65536.");
	}

	return Tuple2.of(hostname, port);
}
 
Example 3
Source File: HighAvailabilityServicesUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the JobManager's hostname and port extracted from the given
 * {@link Configuration}.
 *
 * @param configuration Configuration to extract the JobManager's address from
 * @return The JobManager's hostname and port
 * @throws ConfigurationException if the JobManager's address cannot be extracted from the configuration
 */
public static Tuple2<String, Integer> getJobManagerAddress(Configuration configuration) throws ConfigurationException {

	final String hostname = configuration.getString(JobManagerOptions.ADDRESS);
	final int port = configuration.getInteger(JobManagerOptions.PORT);

	if (hostname == null) {
		throw new ConfigurationException("Config parameter '" + JobManagerOptions.ADDRESS +
			"' is missing (hostname/address of JobManager to connect to).");
	}

	if (port <= 0 || port >= 65536) {
		throw new ConfigurationException("Invalid value for '" + JobManagerOptions.PORT +
			"' (port of the JobManager actor system) : " + port +
			".  it must be greater than 0 and less than 65536.");
	}

	return Tuple2.of(hostname, port);
}