You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/11/09 07:10:54 UTC

[incubator-eventmesh] branch master updated: Update ShowClientHandler.java

This is an automated email from the ASF dual-hosted git repository.

mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new e72514ab Update ShowClientHandler.java
     new 1bea9078 Merge pull request #2143 from hm1365166/master
e72514ab is described below

commit e72514ab852e3c19bdaf4584969f7958daa68026
Author: BUgMaSter <31...@users.noreply.github.com>
AuthorDate: Wed Nov 9 12:33:53 2022 +0800

    Update ShowClientHandler.java
    
    try 释放资源
---
 .../eventmesh/runtime/admin/handler/ShowClientHandler.java   | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowClientHandler.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowClientHandler.java
index 69eda654..0e1c9bf8 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowClientHandler.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/ShowClientHandler.java
@@ -51,8 +51,7 @@ public class ShowClientHandler implements HttpHandler {
     @Override
     public void handle(HttpExchange httpExchange) throws IOException {
         StringBuilder result = new StringBuilder();
-        OutputStream out = httpExchange.getResponseBody();
-        try {
+        try (OutputStream out = httpExchange.getResponseBody()) {
             String newLine = System.getProperty("line.separator");
             logger.info("showAllClient=================");
             ClientSessionGroupMapping clientSessionGroupMapping = eventMeshTCPServer.getClientSessionGroupMapping();
@@ -79,15 +78,6 @@ public class ShowClientHandler implements HttpHandler {
             out.write(result.toString().getBytes(Constants.DEFAULT_CHARSET));
         } catch (Exception e) {
             logger.error("ShowClientHandler fail...", e);
-        } finally {
-            if (out != null) {
-                try {
-                    out.close();
-                } catch (IOException e) {
-                    logger.warn("out close failed...", e);
-                }
-            }
         }
-
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org