From 326cd2fe9a756300eb382d922039fe490b374eec Mon Sep 17 00:00:00 2001 From: hengyunabc Date: Wed, 7 Nov 2018 17:31:50 +0800 Subject: [PATCH] allow skip bind telnet port or http port. fix #284 --- .../arthas/core/server/ArthasBootstrap.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java b/core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java index 2661bdac..e0e439ea 100644 --- a/core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java +++ b/core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java @@ -85,10 +85,18 @@ public class ArthasBootstrap { List resolvers = new ArrayList(); resolvers.add(builtinCommands); // TODO: discover user provided command resolver - shellServer.registerTermServer(new TelnetTermServer( - configure.getIp(), configure.getTelnetPort(), options.getConnectionTimeout())); - shellServer.registerTermServer(new HttpTermServer( - configure.getIp(), configure.getHttpPort(), options.getConnectionTimeout())); + if (configure.getTelnetPort() > 0) { + shellServer.registerTermServer(new TelnetTermServer(configure.getIp(), configure.getTelnetPort(), + options.getConnectionTimeout())); + } else { + logger.info("telnet port is {}, skip bind telnet server.", configure.getTelnetPort()); + } + if (configure.getHttpPort() > 0) { + shellServer.registerTermServer(new HttpTermServer(configure.getIp(), configure.getHttpPort(), + options.getConnectionTimeout())); + } else { + logger.info("http port is {}, skip bind http server.", configure.getHttpPort()); + } for (CommandResolver resolver : resolvers) { shellServer.registerCommandResolver(resolver);