Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/3391#discussion_r103203014
--- Diff:
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebRuntimeMonitor.java
---
@@ -414,19 +410,36 @@ protected void initChannel(SocketChannel ch) {
NioEventLoopGroup bossGroup = new NioEventLoopGroup(1);
NioEventLoopGroup workerGroup = new NioEventLoopGroup();
+
+ final String configuredAddress = cfg.getWebFrontendAddress();
+ final Iterator<Integer> configuredPortRange =
cfg.getWebFrontendPortRange();
+
this.bootstrap = new ServerBootstrap();
this.bootstrap
.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(initializer);
- ChannelFuture ch;
- if (configuredAddress == null) {
- ch = this.bootstrap.bind(configuredPort);
- } else {
- ch = this.bootstrap.bind(configuredAddress,
configuredPort);
+
+ try {
+ this.serverChannel =
NetUtils.createServerFromPorts(configuredAddress, configuredPortRange, new
NetUtils.ServerFactory<Channel>() {
+ @Override
+ public Channel create(String address, int port)
throws Exception {
+ ChannelFuture ch;
+ if (address == null) {
+ ch = bootstrap.bind(port);
+ } else {
+ ch = bootstrap.bind(address,
port);
+ LOG.info("Web frontend
listening at configuredAddress " + address );
+ }
+
+ return ch.sync().channel();
+ }
+ });
+ } catch (Exception e) {
+ throw new BindException(e.getMessage());
--- End diff --
Only forwarding exception messages is not good. Please preserve the cause
of the failure.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---