You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "TYzzt (via GitHub)" <gi...@apache.org> on 2023/03/08 05:30:16 UTC

[GitHub] [inlong] TYzzt commented on a diff in pull request #7549: [INLONG-7548][Agent][Manager] Use try-with-resource to close resources

TYzzt commented on code in PR #7549:
URL: https://github.com/apache/inlong/pull/7549#discussion_r1128991249


##########
inlong-agent/agent-core/src/main/java/org/apache/inlong/agent/core/conf/ConfigJetty.java:
##########
@@ -62,10 +62,11 @@ public ConfigJetty(JobManager jobManager, TriggerManager triggerManager) {
     }
 
     private void initJetty() throws Exception {
-        ServerConnector connector = new ServerConnector(this.server);
-        connector.setPort(conf.getInt(
-                AgentConstants.AGENT_HTTP_PORT, AgentConstants.DEFAULT_AGENT_HTTP_PORT));
-        server.setConnectors(new Connector[]{connector});
+        try (ServerConnector connector = new ServerConnector(this.server)) {
+            connector.setPort(conf.getInt(
+                    AgentConstants.AGENT_HTTP_PORT, AgentConstants.DEFAULT_AGENT_HTTP_PORT));
+            server.setConnectors(new Connector[]{connector});
+        }

Review Comment:
   restored



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org