rafaelweingartner commented on a change in pull request #2762: Make HTTP
handler of embedded server to be configured
URL: https://github.com/apache/cloudstack/pull/2762#discussion_r204493793
##########
File path: client/src/main/java/org/apache/cloudstack/ServerDaemon.java
##########
@@ -163,11 +171,13 @@ public void start() throws Exception {
httpConfig.setSendDateHeader(false);
// HTTP Connector
- final ServerConnector httpConnector = new ServerConnector(server, new
HttpConnectionFactory(httpConfig));
- httpConnector.setPort(httpPort);
- httpConnector.setHost(bindInterface);
- httpConnector.setIdleTimeout(30000);
- server.addConnector(httpConnector);
+ if (httpEnable) {
+ final ServerConnector httpConnector = new ServerConnector(server,
new HttpConnectionFactory(httpConfig));
Review comment:
Well, this method has almost 100 lines. We do not have documented why some
of these operations are there, and we also do not have unit tests for this part
of the code (as I would expect with a big method as this one).
Extracting blocks of code to smaller methods helps us to document and unit
test the code. In this case, it is the block of code that enables and
configures the HTTP connector. This single chunk can live on its own method
that can be further documented and tested.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services