flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] yanghua commented on a change in pull request #7263: [FLINK-11081] Support binding port range for REST server
Date Wed, 12 Dec 2018 07:33:18 GMT
yanghua commented on a change in pull request #7263: [FLINK-11081] Support binding port range
for REST server
URL: https://github.com/apache/flink/pull/7263#discussion_r240905696
 
 

 ##########
 File path: flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestServerEndpoint.java
 ##########
 @@ -181,14 +184,44 @@ protected void initChannel(SocketChannel ch) {
 				.channel(NioServerSocketChannel.class)
 				.childHandler(initializer);
 
-			log.debug("Binding rest endpoint to {}:{}.", restBindAddress, restBindPort);
-			final ChannelFuture channel;
-			if (restBindAddress == null) {
-				channel = bootstrap.bind(restBindPort);
-			} else {
-				channel = bootstrap.bind(restBindAddress, restBindPort);
+			ChannelFuture channel;
+
+			// parse port range definition and create port iterator
+			Iterator<Integer> portsIterator;
+			try {
+				portsIterator = NetUtils.getPortRangeFromString(restBindPort);
+			} catch (Exception e) {
 
 Review comment:
   OK, thank you for your clarification. It seems that I misunderstood what you mean. I thought
you meant to capture Exception and could not catch IllegalConfigurationException. Now it seems
that what you mean is that we should break down the capture of a particular exception. Considering
that `NetUtils.getPortRangeFromString` will throw at least two possible exceptions, one checked
and one unchecked. I think we capture Exception directly.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message